List members of Local Group on Member Server

List members of Local Group on Member Server

Post by Jerry Woo » Fri, 02 Nov 2001 00:33:55



I am looking for a code snippet to show me how to use ADSI
or WMI to get to the information I need.  My specific
problem is when getting the domain name of the object.  An
example would be the local Administrators group has two
global groups in it named x/Domain Admins and y/Domain
Admins.  When I list the members to a text file I lose the
domain the global groups is from.
 
 
 

List members of Local Group on Member Server

Post by Max L. Vaug » Fri, 02 Nov 2001 01:19:17


You could use the ADsPath property of the object, that will give you the a
bindable string to the object, but, you would need to parse it to obtain
the domain\userid.

Another method would be to bind to the object and retrieve the ObjectSID
property, then use the LookupAccountName API to find the domain and user
ID.  Another method would be to  use the ADsSID object hosted by
ADsSecurity.Dll to retrieve the Sam Account Name for the object.

Later,
max Vaughn
Microsoft Developer Support

Disclaimer: This posting is provided AS IS with no warranties, and
confers no rights. You assume all risk for your use. ? 2001 Microsoft
Corporation. All rights reserved

 
 
 

List members of Local Group on Member Server

Post by Jerry Woo » Fri, 02 Nov 2001 02:25:28


Thanks I'll look into the options you mentioned.