[RESOLVED] VBS - Active Directory - Listing Groups assigned to 1 computer
Hi.
I've looked just about everywhere for help on this.
I have a script (at work) that can query Active Directory for a Computer name and can get some details form it such as the Description field. That works fine.
What I can't seem to figure out, is listing all the Groups that are assigned to that Computer.
I can do this with users, and other groups no problem.
Below is a copy of page of public code.
What would I need to do to this?
Code:
On Error Resume Next
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.Properties("Page Size") = 1000
objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE
objCommand.CommandText = _
"SELECT Name FROM 'LDAP://dc=fabrikam,dc=com' WHERE objectCategory='computer' " & _
"AND Name='atl-ws-01'"
Set objRecordSet = objCommand.Execute
objRecordSet.MoveFirst
Do Until objRecordSet.EOF
Wscript.Echo objRecordSet.Fields("Name").Value
objRecordSet.MoveNext
Loop