Login | |
|
 |
RE: AD -List members from Global Group and nested group - 1/2/2007 1:52:26 AM
|
|
 |
|
| |
SAPIENScripter
Posts: 276
Score: 2
Joined: 11/1/2006
From: SAPIEN Technologies
Status: offline
|
You need to take your script for enumerating groups and check the class of each member. If the class is group, then call your group enumeration subroutine or function again.
_____________________________
Jeffery Hicks Windows PowerShell MVP SAPIEN Technologies - Scripting, Simplified. www.SAPIEN.com Follow Me: http://www.twitter.com/JeffHicks
|
|
| |
|
|
|
 |
RE: AD -List members from Global Group and nested group - 1/2/2007 2:14:01 AM
|
|
 |
|
| |
A.Bedeker
Posts: 8
Score: 0
Joined: 12/21/2006
Status: offline
|
Do you have an example-script? I'm not that good with the scripting stuff...
|
|
| |
|
|
|
 |
RE: AD -List members from Global Group and nested group - 1/2/2007 2:25:30 AM
|
|
 |
|
| |
dm_4ever
Posts: 2722
Score: 46
Joined: 6/29/2006
From: Orange County, California
Status: offline
|
quote:
A.Bedeker - I've tried several scripts, but none was complete. Why don't you post what you have tried or currently have?
_____________________________
dm_4ever My philosophy: K.I.S.S - Keep It Simple Stupid Read Me: http://www.visualbasicscript.com/m_24727/tm.htm Frequently Asked Stuff: http://www.visualbasicscript.com/m_47117/tm.htm
|
|
| |
|
|
|
 |
RE: AD -List members from Global Group and nested group - 1/2/2007 2:28:32 AM
|
|
 |
|
| |
A.Bedeker
Posts: 8
Score: 0
Joined: 12/21/2006
Status: offline
|
Didn't saved the scripts...because they did'n't work...
|
|
| |
|
|
|
 |
RE: AD -List members from Global Group and nested group - 1/2/2007 2:53:21 AM
|
|
 |
|
| |
ebgreen
Posts: 5246
Score: 31
Joined: 7/12/2005
Status: online
|
Then perhaps you should find those non-working scripts again. Then post one that comes the closest to doing what you want along with a desription of what it does wrong or doesn't do right.
_____________________________
"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm http://www.visualbasicscript.com/m_47117/tm.htm
|
|
| |
|
|
|
 |
RE: AD -List members from Global Group and nested group - 1/2/2007 11:00:07 PM
|
|
 |
|
| |
A.Bedeker
Posts: 8
Score: 0
Joined: 12/21/2006
Status: offline
|
I found a script wich places all the members in a textfile. Now I need the nested members as well: On Error Resume Next gga= inputbox("Which global group?") gga = "CN="&gga Set objShell = Wscript.CreateObject("Wscript.Shell") Set objFSO = CreateObject("Scripting.FileSystemObject") Set objOU = GetObject("LDAP://OU=Application Management Groups,OU=Security Groups,DC=AD,DC=Intra") 'input the full LDAP path to your group's OU here objDesktop = objShell.SpecialFolders("Desktop") For Each Group In objOU If InStr(Group.Name, gga) Then 'input the name of the AD group to query here Set objFile = objFSO.CreateTextFile(objDesktop & "\AD\Members of " & Group.Name & ".txt", 2) objFile.WriteLine Group.Name objFile.WriteLine "=======================" objFile.WriteLine Set objGroup = GetObject _ ("LDAP://" & Group.Name & ",OU=Application Management Groups,OU=Security Groups,DC=AD,DC=Intra") 'input the full LDAP path to your group's OU here objGroup.GetInfo arrMemberOf = objGroup.GetEx("member") For Each strMember In arrMemberOf Set objUser = GetObject("LDAP://" & strMember) objFile.WriteLine objUser.samaccountname Next objFile.Close End If Next MsgBox "Completed script.",64,"Informational"
|
|
| |
|
|
|
 |
RE: AD -List members from Global Group and nested group - 1/3/2007 9:11:22 PM
|
|
 |
|
| |
A.Bedeker
Posts: 8
Score: 0
Joined: 12/21/2006
Status: offline
|
Finaly got my script working. For those who are interested: On Error Resume Next Dim UserCount, gga, CNgga gga= inputbox("Which global group?") 'Get the requested Global Group CNgga = "CN="&gga 'Change the group to a CN request Set objShell = Wscript.CreateObject("Wscript.Shell") Set objFSO = CreateObject("Scripting.FileSystemObject") Set objOU = GetObject("LDAP://OU=Application Management Groups,OU=Security Groups,DC=AD,DC=Intra") 'input the full LDAP path to your group's OU here objDesktop = objShell.SpecialFolders("Desktop") 'Folder for the output file For Each Group In objOU If InStr(Group.Name, CNgga) Then 'input the name of the AD group to query here Set objFile = objFSO.CreateTextFile(objDesktop & "\AD\Members of " & Group.Name & ".txt", 2) 'Create the file set UserCount = 0 objFile.WriteLine Group.Name objFile.WriteLine "==================================" Set objGroup = GetObject ("LDAP://" & Group.Name & ",OU=Application Management Groups,OU=Security Groups,DC=AD,DC=Intra") 'input the full LDAP path to your group's OU here objGroup.GetInfo arrMemberOf = objGroup.GetEx("member") For Each strMember In arrMemberOf Set objUser = GetObject("LDAP://" & strMember) Select Case objUser.class Case "user" objFile.WriteLine " " & objUser.samaccountname &" - " & objUser.Class UserCount = UserCount + 1 Case "group" 'objFile.WriteLine objUser.samaccountname &" - " & objUser.Class &" - " & objUser.distinguishedName enumGroupMembers(objUser.distinguishedName) End Select Next objFile.WriteLine "Aantal gebruikers: " & UserCount 'Gives a total count of all the users. objFile.Close End If Next MsgBox "Completed script.",64,"Informational" Sub enumGroupMembers(sObjDN) Dim oContainer, obj, sDN Set oContainer=GetObject ("LDAP://" & sObjDN) For each obj in oContainer.members Select Case LCase(obj.Class) Case "user" , "contact" objFile.WriteLine " " & obj.sAMAccountName &" - " & obj.Class UserCount = UserCount + 1 Case "group" 'objFile.WriteLine obj.sAMAccountName &" - " & obj.Class &" - " & objUser.distinguishedName EnumGroupMembers obj.distinguishedName End Select Next End Sub
|
|
| |
|
|
|
| |
|
|
 |
|
 |
|
|