Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Users and Group Membership

Domain Admin

Users and Group Membership

by  mrmovie  Posted    (Edited  )
'one way of doing it
'this will work with Active Dir and NT domains

Set Container = GetObject("WinNT://DomainNameHere")
Container.Filter = Array("user")
For Each User In Container
For Each aGroup In User.Groups
Wscript.Echo User.Name & "=" & aGroup.Name
Next
Next

'if you want other user properties then
Set Container = GetObject("WinNT://DOMFSC01")
Container.Filter = Array("user")
For Each User In Container
Wscript.Echo User.Name & "=" & User.LastLogin
Next

'the WinNT provider does not expose all of the AD properties,only the ones which were available in NT domains, if you want to do that then use ADSI and an LDAP query to return more fields/properties
Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top