G
GerardSamuel
Guest
Hello,
If this topic is not in the right newsgroup, could you please suggest where
else I can post. Thanks
I'm attempting to put together a VBScript that searches Active Directory for
a specific group of computer objects.
I found this script, that I'm trying to modify so it my needs.
In the script, if I use the LIKE statement to find any computer objects that
start with BBX, the script fails when it trys to execute with ->
C:\temp\z.vbs(13, 1) Provider: One or more errors occurred during processing
of command.
Does anyone have any idea why I'm getting this error, and how to fix, or can
suggest another way for me to retrieve a group of computer objects that
starts with a common characters with VBScript/WMI.
Thanks
-----
Const ADS_SCOPE_SUBTREE = 2
Set objConnection = CreateObject("ADODB.Connection")
Set objCommand = CreateObject("ADODB.Command")
objConnection.Provider = "ADsDSOObject"
objConnection.Open "Active Directory Provider"
Set objCommand.ActiveConnection = objConnection
objCommand.CommandText = "Select Name from 'LDAP://DC=bbx,DC=com' where Name
LIKE 'BBX%' AND objectClass='computer'"
objCommand.Properties("Page Size") = 1000
objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE
Set objRecordSet = objCommand.Execute
objRecordSet.MoveFirst
Do Until objRecordSet.EOF
Wscript.Echo "Computer Name: " & objRecordSet.Fields("Name").Value
objRecordSet.MoveNext
Loop
If this topic is not in the right newsgroup, could you please suggest where
else I can post. Thanks
I'm attempting to put together a VBScript that searches Active Directory for
a specific group of computer objects.
I found this script, that I'm trying to modify so it my needs.
In the script, if I use the LIKE statement to find any computer objects that
start with BBX, the script fails when it trys to execute with ->
C:\temp\z.vbs(13, 1) Provider: One or more errors occurred during processing
of command.
Does anyone have any idea why I'm getting this error, and how to fix, or can
suggest another way for me to retrieve a group of computer objects that
starts with a common characters with VBScript/WMI.
Thanks
-----
Const ADS_SCOPE_SUBTREE = 2
Set objConnection = CreateObject("ADODB.Connection")
Set objCommand = CreateObject("ADODB.Command")
objConnection.Provider = "ADsDSOObject"
objConnection.Open "Active Directory Provider"
Set objCommand.ActiveConnection = objConnection
objCommand.CommandText = "Select Name from 'LDAP://DC=bbx,DC=com' where Name
LIKE 'BBX%' AND objectClass='computer'"
objCommand.Properties("Page Size") = 1000
objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE
Set objRecordSet = objCommand.Execute
objRecordSet.MoveFirst
Do Until objRecordSet.EOF
Wscript.Echo "Computer Name: " & objRecordSet.Fields("Name").Value
objRecordSet.MoveNext
Loop