Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Enumerate groups for a computer

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,2758
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Enumerate groups for a computer
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 Enumerate groups for a computer - 4/20/2005 1:04:59 PM   
  antun

 

Posts: 9
Score: 0
Joined: 4/20/2005
From:
Status: offline
Hey, i want to be able to get all the groups a computer is a member on, in the domain


      

This works, however if you have the computer in a different OU, it wont be able to find it.

so is tehre a way that you could search through the whole thing and get the groups for the computer?

This is for computers running XP, server 2003.
 
 
Post #: 1
 
 Re: Enumerate groups for a computer - 4/20/2005 3:50:01 PM   
  token

 

Posts: 1917
Score: 0
Joined: 1/14/2005
From:
Status: offline
host = "ComputerName"
Set conn = CreateObject("ADODB.Connection")
Set cmd = CreateObject("ADODB.Command")
conn.provider = "adsdsoobject"
conn.open "active directory provider"
cmd.activeconnection = conn
cmd.commandtext = "<LDAP://" & GetObject("LDAP://rootdse").Get("defaultnamingcontext") & ">;(&(objectclass=computer)(cn=" & host & "));distinguishedname;subtree"
Set rs = cmd.Execute
dn = rs.fields("distinguishedname")

Set computer = GetObject("LDAP://" & dn)
For Each Grp in computer.groups
ListGroups = ListGroups & Grp.name & vbtab
Next
msgbox ListGroups

(in reply to antun)
 
 
Post #: 2
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Enumerate groups for a computer Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts