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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Group Membership

Status
Not open for further replies.

BDakis

MIS
Nov 26, 2003
12
US
I need to write a script that will reference a list of users and query the (NT4) domain for their group memberships and then pipe that info into a readable file. I appreciate any help you can provide. Thanks!
 
Download ADSI Scriptomatic from Microsoft. It should get you started.
 
do you have any code yourself? what have you tried so far? are you sitting behind a desk in a rush and dont want to learn anything? i am not being clever i feel it is for your own good? you clearly know how to use the internet, why not go the whole hog and look at the other posts in this forum or do a key word search

2 posts above yours is SIPIN's on the same subject with an answer

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


 
I am in no rush, and would prefer to take a step back and learn. I have no code yet, but do have 'scriptomatic.'
the real task I want is to write a script that will parse a text file list of user IDs and for each ID reference the AD for each group that user belongs to and pipe it to a log file that I can import in to excel (for example).
 
well in that case the first thing your program will need to do is parse a text file.

start with the filesystemobject and opentextfile method. then you might want to make a decision on if you want to load you text file list of users into memory, i.e load it into an array or if you want to make sure all the names are unique then load it into a dictionary object.

once you have a list you can loop through it (or if you dont want to load it into memory the loop through the users can be as you read the text file) and query AD or NT domain for the domains the user is a member of. at which point you need to decide where and how to put the information. this again will bring you back to FileSystemObject and CreateTextFile or OpenTextFile.

i personally would beg the question, "why do you need the text file of users to parse?", this information is already contained in AD or NT domain. why not read it directly from there?
 
mrmovie-
first of all, thanks for the reply! I have been reading several threads and you are an active and extremely helpful contributor in basically all of them; newbies to vbscript like myself really appreciate (and desperately need) that.
the reason I need to reference a text file is beacause I am dealing with a particular functionl-group of users that are not neatly grouped into a domain group. the group # is 4175 and ideally, all of the users I need to validate would be in my domain group of that name, but that isnt the case. what I have to reference is a text file from a business rep.
I have already scripted a solution in shell to help me with my task, but I want to learn how to do these sorts of things in vbs. you have given me some good info, thanks!!
 
if you get stuck post in this thread and will try and guide you rather than post code, best of luck and thanks for the comments.

mrmovie
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top