How to query local groups on a server and get members back in domain\user format? 
Author Message
 How to query local groups on a server and get members back in domain\user format?

I need to query local groups on large number of servers and if these
local groups contain members from three specific domains, then I need
that information captured. The servers are NT 4.0.  Querying group
members like I did below, does not give me the domain they belong to
which is what I am looking for.  Any suggestions on how to get
domain\username for every user in a local group?

Dim userGroup
Dim user

Set userGroup = GetObject("WinNT://Memberserver1/administrators")

For Each user In userGroup.Members
    WScript.Echo user.Class & ": " & user.Name
    WScript.Echo user.Description
    WScript.Echo
Next



Tue, 14 Dec 2004 01:07:05 GMT  
 How to query local groups on a server and get members back in domain\user format?

Quote:

> I need to query local groups on large number of servers and if these
> local groups contain members from three specific domains, then I need
> that information captured. The servers are NT 4.0.  Querying group
> members like I did below, does not give me the domain they belong to
> which is what I am looking for.  Any suggestions on how to get
> domain\username for every user in a local group?

Dim userGroup
Dim user

Set userGroup = GetObject("WinNT://./administrators")

For Each user In userGroup.Members
    WScript.Echo user.Class & ": " & user.Name
    WScript.Echo user.adspath
    WScript.Echo
Next

--
Michael Harris
Microsoft.MVP.Scripting
Seattle WA US
--



Tue, 14 Dec 2004 01:25:14 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. How do I add a domain global-groups in a member-server local group

2. Enumerate Local Groups a user is a member of from a different domain

3. Enumerate Local Groups a user is a member of from a different domain

4. Enumerate Local Group Members and Identify Domain of Members

5. Is local computer Domain Controller or Member Server

6. Delete Domain user from Local Group

7. Add domain user to local PC Admins group?

8. Add Domain Users Group to Powe Users Group in Script

9. help Adding a Domain group to a Local Group

10. Add domain group to local group

11. Adding domain groups to gthe local administrator group

12. Adding a Domain Global group to a machine local group in Windows 2000

 

 
Powered by phpBB® Forum Software