[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 312
  • Last Modified:

Looking for a way to query for user Group information

Hi experts,

I have been looking for a way to get all a users group information to be able to map network drives.

So far I have looked at the AD Directory.Searcher classes which seem to fail everytime I use them and haven't come across any resources on how to do this safely or easily.

If any of you have information on this please post it.

I have the username.  I just need to collect all the GROUPS...
0
Joesmail
Asked:
Joesmail
  • 4
  • 2
2 Solutions
 
Julian HansenCommented:
Not sure what development environment you are in but here is some VBScript that does the trick (C++ is a bit messy so I won't post that code unless specifically asked for)

Dim domain

set user = GetObject ( "WinNT://Domain/UserName" )

for each group in user.Groups
  wscript.echo group.name
next

Alternatively this thread may help

http://www.experts-exchange.com/Programming/Programming_Languages/C_Sharp/Q_21755548.html
0
 
Renato Montenegro RusticiIT SpecialistCommented:
You may consider using KIX32. Its perfect for login scripts.

http://www.kixtart.org
0
 
Renato Montenegro RusticiIT SpecialistCommented:
Oh yes... i forgot. You can enumerate group membership in KIX.
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
JoesmailAuthor Commented:
Thanks for the comments.  Used the C# directory.searcher to enumerate the groups...
0
 
JoesmailAuthor Commented:
The kixstart documentation mentioned that they obtain the username/group details from the SID of the user at logon.
Do you know the WMI info to obtain this?

Also (probably a simple one).  How do you obtain the NETLOGON directory as a path when logging in.  Is this just from adding the logonserver variable to NETLOGON e.g. \\<server>\NETLOGON?  If you know of a better way would like to know.
0
 
Renato Montenegro RusticiIT SpecialistCommented:
Please, try this:

Create a batch file (loginscript.bat) and put the following:
%0\..\kix32.exe myrealscript.kix

Check this page for additional information:

http://support.microsoft.com/?kbid=318689
0
 
Renato Montenegro RusticiIT SpecialistCommented:
So ... %0\..\ is the netlogon path
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 4
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now