Help - Search - Members - Calendar
Full Version: Example VBScript for create an list of servers to import
Intellipool Network Monitor - Forum > Intellipool Network Monitor > Lua scripts
zefrench
This is a script I put together to go through active directory and create a text file of all the servers, ready to import.

I know this is not LUA, so please move this scirpt to the right forum if need be.

Martin

CODE
' This code makes a list of server to inport in intellipool
' ------ SCRIPT CONFIGURATION ------
strActiveDirectoryDomainDNSName = ""domain.com"
strObjectNamePrefix = "CUSTOMER-"
' ------ END CONFIGURATION ---------
strBase = "<LDAP://" & strActiveDirectoryDomainDNSName & ">;"
Set objFS = CreateObject ("Scripting.FileSystemObject")
Set objFileOut = objFS.OpenTextFile ("inm_listofservers.txt", 2, True)

strFilter = "(&(objectclass=computer)(objectcategory=computer)" & _
"(operatingSystem=*Server*));"
strAttrs = "cn;"
strScope = "subtree"
set objConn = CreateObject("ADODB.Connection")
objConn.Provider = "ADsDSOObject"
objConn.Open "Active Directory Provider"
Wscript.Echo strBase & strFilter & strAttrs & strScope
Set objRS = objConn.Execute(strBase & strFilter & strAttrs & strScope)
objRS.MoveFirst
while Not objRS.EOF
Wscript.Echo objRS.Fields(0).Value
objFileOut.WriteLine( strObjectNamePrefix & lcase(objRS.Fields(0).Value) & ";" & lcase(objRS.Fields(0).Value) & "." & strActiveDirectoryDomainDNSName & ";" & "automatically imported")
objRS.MoveNext
wend

objFileOut.Close
Set objFileOut = Nothing
Set objFS = Nothing
RA
Nice work there, I should rename this forum "Scripts" instead !!
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2010 Invision Power Services, Inc.