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

List IDs in security groups? 1

Status
Not open for further replies.

theniteowl

Programmer
May 24, 2005
1,975
US
Hi All,
I use this code to look up a logon ID and show the groups it belongs to.
Code:
strUsername="DOMAIN/ID"
    set adsUser = getobject("WinNT://" & strUsername)
    for each group in adsUser.groups
         GrpList = GrpList & lcase(trim(group.name)) & vbcrlf
    next
msgbox GrpList

Does anyone have a way to list out the IDs that belong to a specific group?


At my age I still learn something new every day, but I forget two others.
 
theniteowl,
Code:
Set adsGroup = getobject("WinNT://" & strDomain & "/" & strGroupname)
Set adsMembers = adsGroup.Members
For Each varItem in adsMembers
  Debug.Print varItem.Name, varItem.Class, varItem.ADSPath
Next varItem

Hope this helps,
CMP

[small]For the best results do what I'm thinking, not what I'm saying.[/small]
(GMT-07:00) Mountain Time (US & Canada)
 
I was getting an expected end of statement error on the last line so I just commented out the varItem and it works fine.

I am executing this currently from a .vbs file so that may be why it did not like Next varItem but accepted Next by itself?

Thanks much for the code. I am trying to put something together to track membership and access levels for one of our applications.

Do you know of a way in VB to list out what groups or IDs are setup in a folder tree so that I could easily generate lists of groups in the folders so we can audit the access permission easily?

I want to eventually tie into a feed from CHR so that when a person transfers departments it will send off an email notification that a group change needs to be made.

Thanks again.



At my age I still learn something new every day, but I forget two others.
 
theniteowl,
folder tree? Are you looking for permission to folders/resources on a network?

CMP

[small]For the best results do what I'm thinking, not what I'm saying.[/small]
(GMT-07:00) Mountain Time (US & Canada)
 
I am looking to list out what users or groups have been applied to a folder and if possible the permissions set for that user/group.

If I can do it I would like to start at a specified folder and traverse all sub folders building a listing of security set on those folders for easy auditing of security and eventually the ability to enter a user ID and have it report back what rights a specified user has in any given folder in the tree.

I have administrative access to the servers, the code would just make it easy to automate some checks.

At my age I still learn something new every day, but I forget two others.
 
theniteowl,
I've got no clue. I've worked with Users and Groups in previous projects and that's it. I spent some time digging around in the Object Browser and searching MSDN to see if I could get the gist of how things are setup to no avail.

Since I don't have a Microsoft Active Directory environment to play with I can't even reverse engineer something by digging around in the Locals window (my favorite tool when the Object Browser doesn't make sense to me).

I know you are writing this in VBS, if your editor has an equivalent to the VBE/MSE Object Browser & Locals window I would say just start declaring objects of different types ([tt]IADsResource[/tt], [tt]IADsFileShare[/tt]..?) and see what pieces and parts are available for each.

Sorry I couldn't be of more help. If you figure this out please post your solution for the benefit of others.

Happy hunting,
CMP

[small]For the best results do what I'm thinking, not what I'm saying.[/small]
(GMT-07:00) Mountain Time (US & Canada)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top