|
server
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
List Users and Attributes in Multiple Groups
Hi, I'm relatively new to scripting and have run a search to find a script
that will let me feed it a list of AD Groups and extract attributes for all the users in the groups. I have a small script that will let me retrieve the LDAP name, but would also like to extract things like LANID, Display Name, Group Name, EmployeeID in a table that I can sort. I'll continue my search but I thought I would post here to see what may be available untill I find something. Thanks, -- Don S On Sep 25, 1:56 pm, DSchenk952 <DSchenk***@discussions.microsoft.com>
wrote: > Hi, I'm relatively new to scripting and have run a search to find a script Don,> that will let me feed it a list of AD Groups and extract attributes for all > the users in the groups. I have a small script that will let me retrieve the > LDAP name, but would also like to extract things like LANID, Display Name, > Group Name, EmployeeID in a table that I can sort. > > I'll continue my search but I thought I would post here to see what may be > available untill I find something. > > Thanks, > -- > Don S Can you post the script you're currently using? -J www.pooradmin.com In this script I'm getting the group member LDAP name back, (if I'm saying
that correctly). And would like the output on LANID, GroupName, EmployeeID, etc., =============================== On Error Resume Next Set objGroup = GetObject _ ("LDAP://cn=Forest Owners,ou=Global Admins,dc=Don,dc=Corvette,dc=com") objGroup.GetInfo arrMemberOf = objGroup.GetEx("member") WScript.Echo "Forest Owners" For Each strMember in arrMemberOf WScript.echo strMember Next Set objGroup = GetObject _ ("LDAP://cn= Service Admins,ou=Global Admins,dc=Don,dc=Corvette,dc=com") objGroup.GetInfo arrMemberOf = objGroup.GetEx("member") WScript.Echo "" WScript.Echo "Service Admins" For Each strMember in arrMemberOf WScript.echo strMember Next Set objGroup = GetObject _ ("LDAP://cn=Data Admins,ou=Global Admins,dc=Don,dc=Corvette,dc=com") objGroup.GetInfo arrMemberOf = objGroup.GetEx("member") WScript.Echo "" WScript.Echo "Data Admins" For Each strMember in arrMemberOf WScript.echo strMember Next Set objGroup = GetObject _ ("LDAP://cn=ServiceDesk Operators,ou=Global Admins,dc=Don,dc=Corvette,dc=com") objGroup.GetInfo arrMemberOf = objGroup.GetEx("member") WScript.Echo "" WScript.Echo "ServiceDesk Operators" For Each strMember in arrMemberOf WScript.echo strMember Next Set objGroup = GetObject _ ("LDAP://cn=IT_DBA,ou=Server Admins,ou=Servers,dc=Don,dc=Corvette,dc=com") objGroup.GetInfo arrMemberOf = objGroup.GetEx("member") WScript.Echo "" WScript.Echo "IT_DBA" For Each strMember in arrMemberOf WScript.echo strMember Next ============================== -- Show quoteDon S "JakeDAHS" wrote: > On Sep 25, 1:56 pm, DSchenk952 <DSchenk***@discussions.microsoft.com> > wrote: > > Hi, I'm relatively new to scripting and have run a search to find a script > > that will let me feed it a list of AD Groups and extract attributes for all > > the users in the groups. I have a small script that will let me retrieve the > > LDAP name, but would also like to extract things like LANID, Display Name, > > Group Name, EmployeeID in a table that I can sort. > > > > I'll continue my search but I thought I would post here to see what may be > > available untill I find something. > > > > Thanks, > > -- > > Don S > > Don, > > Can you post the script you're currently using? > > -J > www.pooradmin.com > > I suggest using the Members method of the group object, which returns a
collection of member objects. With the member objects you can retrieve any attribute values desired. For example: =========== Set objGroup = GetObject _ ("LDAP://cn=Forest Owners,ou=Global Admins,dc=Don,dc=Corvette,dc=com") For Each objMember In objGroup.Members Wscript.Echo objMember.sAMAccountName & "," & objGroup.sAMAccountName & "," & objMember.employeeID Next ========= The code you posted displays the member Distinguished Names. The sAMAccountName attribute is the "pre-Windows logon name" of users, and is probably what you call LANID (some call it userID or NT User name). The sAMAccountName attribute of group objects is the NetBIOS name of the group. You could substitute the Common Name of the group with objGroup.cn. The Distinguished Name of the user would be objUser.distinguishedName. Show quote "DSchenk952" <DSchenk***@discussions.microsoft.com> wrote in message news:344531E2-DEC0-4539-A81D-3344F7BB85A1@microsoft.com... > In this script I'm getting the group member LDAP name back, (if I'm saying > that correctly). And would like the output on LANID, GroupName, > EmployeeID, > etc., > > =============================== > > On Error Resume Next > > Set objGroup = GetObject _ > ("LDAP://cn=Forest Owners,ou=Global Admins,dc=Don,dc=Corvette,dc=com") > objGroup.GetInfo > > arrMemberOf = objGroup.GetEx("member") > > WScript.Echo "Forest Owners" > For Each strMember in arrMemberOf > WScript.echo strMember > Next > > Set objGroup = GetObject _ > ("LDAP://cn= Service Admins,ou=Global Admins,dc=Don,dc=Corvette,dc=com") > objGroup.GetInfo > > arrMemberOf = objGroup.GetEx("member") > > WScript.Echo "" > WScript.Echo "Service Admins" > For Each strMember in arrMemberOf > WScript.echo strMember > Next > > Set objGroup = GetObject _ > ("LDAP://cn=Data Admins,ou=Global Admins,dc=Don,dc=Corvette,dc=com") > objGroup.GetInfo > > arrMemberOf = objGroup.GetEx("member") > WScript.Echo "" > WScript.Echo "Data Admins" > For Each strMember in arrMemberOf > WScript.echo strMember > Next > > Set objGroup = GetObject _ > ("LDAP://cn=ServiceDesk Operators,ou=Global > Admins,dc=Don,dc=Corvette,dc=com") > objGroup.GetInfo > > arrMemberOf = objGroup.GetEx("member") > WScript.Echo "" > WScript.Echo "ServiceDesk Operators" > For Each strMember in arrMemberOf > WScript.echo strMember > Next > > Set objGroup = GetObject _ > ("LDAP://cn=IT_DBA,ou=Server > Admins,ou=Servers,dc=Don,dc=Corvette,dc=com") > objGroup.GetInfo > > arrMemberOf = objGroup.GetEx("member") > WScript.Echo "" > WScript.Echo "IT_DBA" > For Each strMember in arrMemberOf > WScript.echo strMember > Next > > ============================== > -- > Don S > > > "JakeDAHS" wrote: > >> On Sep 25, 1:56 pm, DSchenk952 <DSchenk***@discussions.microsoft.com> >> wrote: >> > Hi, I'm relatively new to scripting and have run a search to find a >> > script >> > that will let me feed it a list of AD Groups and extract attributes for >> > all >> > the users in the groups. I have a small script that will let me >> > retrieve the >> > LDAP name, but would also like to extract things like LANID, Display >> > Name, >> > Group Name, EmployeeID in a table that I can sort. >> > >> > I'll continue my search but I thought I would post here to see what may >> > be >> > available untill I find something. >> > >> > Thanks, >> > -- >> > Don S >> >> Don, >> >> Can you post the script you're currently using? >> >> -J >> www.pooradmin.com >> >> Richard,
Thanks. That's great, and does exactly what I'm looking for. Only one more question from this noobie. Where can I find the different values that go along with objMember? Thanks, I appreciate the schooling. -- Show quoteDon S "Richard Mueller [MVP]" wrote: > I suggest using the Members method of the group object, which returns a > collection of member objects. With the member objects you can retrieve any > attribute values desired. For example: > =========== > Set objGroup = GetObject _ > ("LDAP://cn=Forest Owners,ou=Global Admins,dc=Don,dc=Corvette,dc=com") > For Each objMember In objGroup.Members > Wscript.Echo objMember.sAMAccountName & "," & objGroup.sAMAccountName & > "," & objMember.employeeID > Next > ========= > The code you posted displays the member Distinguished Names. The > sAMAccountName attribute is the "pre-Windows logon name" of users, and is > probably what you call LANID (some call it userID or NT User name). The > sAMAccountName attribute of group objects is the NetBIOS name of the group. > You could substitute the Common Name of the group with objGroup.cn. The > Distinguished Name of the user would be objUser.distinguishedName. > > -- > Richard Mueller > Microsoft MVP Scripting and ADSI > Hilltop Lab - http://www.rlmueller.net > -- > > "DSchenk952" <DSchenk***@discussions.microsoft.com> wrote in message > news:344531E2-DEC0-4539-A81D-3344F7BB85A1@microsoft.com... > > In this script I'm getting the group member LDAP name back, (if I'm saying > > that correctly). And would like the output on LANID, GroupName, > > EmployeeID, > > etc., > > > > =============================== > > > > On Error Resume Next > > > > Set objGroup = GetObject _ > > ("LDAP://cn=Forest Owners,ou=Global Admins,dc=Don,dc=Corvette,dc=com") > > objGroup.GetInfo > > > > arrMemberOf = objGroup.GetEx("member") > > > > WScript.Echo "Forest Owners" > > For Each strMember in arrMemberOf > > WScript.echo strMember > > Next > > > > Set objGroup = GetObject _ > > ("LDAP://cn= Service Admins,ou=Global Admins,dc=Don,dc=Corvette,dc=com") > > objGroup.GetInfo > > > > arrMemberOf = objGroup.GetEx("member") > > > > WScript.Echo "" > > WScript.Echo "Service Admins" > > For Each strMember in arrMemberOf > > WScript.echo strMember > > Next > > > > Set objGroup = GetObject _ > > ("LDAP://cn=Data Admins,ou=Global Admins,dc=Don,dc=Corvette,dc=com") > > objGroup.GetInfo > > > > arrMemberOf = objGroup.GetEx("member") > > WScript.Echo "" > > WScript.Echo "Data Admins" > > For Each strMember in arrMemberOf > > WScript.echo strMember > > Next > > > > Set objGroup = GetObject _ > > ("LDAP://cn=ServiceDesk Operators,ou=Global > > Admins,dc=Don,dc=Corvette,dc=com") > > objGroup.GetInfo > > > > arrMemberOf = objGroup.GetEx("member") > > WScript.Echo "" > > WScript.Echo "ServiceDesk Operators" > > For Each strMember in arrMemberOf > > WScript.echo strMember > > Next > > > > Set objGroup = GetObject _ > > ("LDAP://cn=IT_DBA,ou=Server > > Admins,ou=Servers,dc=Don,dc=Corvette,dc=com") > > objGroup.GetInfo > > > > arrMemberOf = objGroup.GetEx("member") > > WScript.Echo "" > > WScript.Echo "IT_DBA" > > For Each strMember in arrMemberOf > > WScript.echo strMember > > Next > > > > ============================== > > -- > > Don S > > > > > > "JakeDAHS" wrote: > > > >> On Sep 25, 1:56 pm, DSchenk952 <DSchenk***@discussions.microsoft.com> > >> wrote: > >> > Hi, I'm relatively new to scripting and have run a search to find a > >> > script > >> > that will let me feed it a list of AD Groups and extract attributes for > >> > all > >> > the users in the groups. I have a small script that will let me > >> > retrieve the > >> > LDAP name, but would also like to extract things like LANID, Display > >> > Name, > >> > Group Name, EmployeeID in a table that I can sort. > >> > > >> > I'll continue my search but I thought I would post here to see what may > >> > be > >> > available untill I find something. > >> > > >> > Thanks, > >> > -- > >> > Don S > >> > >> Don, > >> > >> Can you post the script you're currently using? > >> > >> -J > >> www.pooradmin.com > >> > >> > > > There are many attributes available. This link documents most:
http://www.rlmueller.net/UserAttributes.htm The first spreadsheet documents the user attributes corresponding to most of the tabs in ADUC. The second spreadsheet documents all attributes in a default installation of Windows 2000 AD, and the classes of objects they apply to (user, group, computer, etc). The third spreadsheet documents user object methods available. Note that objMember can be a user, a group, or a computer object. Show quote "DSchenk952" <DSchenk***@discussions.microsoft.com> wrote in message news:E3685C41-2120-4E06-B03B-6BC81230B616@microsoft.com... > Richard, > > Thanks. That's great, and does exactly what I'm looking for. Only one > more > question from this noobie. Where can I find the different values that go > along with objMember? > > Thanks, I appreciate the schooling. > -- > Don S > > > "Richard Mueller [MVP]" wrote: > >> I suggest using the Members method of the group object, which returns a >> collection of member objects. With the member objects you can retrieve >> any >> attribute values desired. For example: >> =========== >> Set objGroup = GetObject _ >> ("LDAP://cn=Forest Owners,ou=Global >> Admins,dc=Don,dc=Corvette,dc=com") >> For Each objMember In objGroup.Members >> Wscript.Echo objMember.sAMAccountName & "," & objGroup.sAMAccountName >> & >> "," & objMember.employeeID >> Next >> ========= >> The code you posted displays the member Distinguished Names. The >> sAMAccountName attribute is the "pre-Windows logon name" of users, and is >> probably what you call LANID (some call it userID or NT User name). The >> sAMAccountName attribute of group objects is the NetBIOS name of the >> group. >> You could substitute the Common Name of the group with objGroup.cn. The >> Distinguished Name of the user would be objUser.distinguishedName. >> >> -- >> Richard Mueller >> Microsoft MVP Scripting and ADSI >> Hilltop Lab - http://www.rlmueller.net >> -- >> >> "DSchenk952" <DSchenk***@discussions.microsoft.com> wrote in message >> news:344531E2-DEC0-4539-A81D-3344F7BB85A1@microsoft.com... >> > In this script I'm getting the group member LDAP name back, (if I'm >> > saying >> > that correctly). And would like the output on LANID, GroupName, >> > EmployeeID, >> > etc., >> > >> > =============================== >> > >> > On Error Resume Next >> > >> > Set objGroup = GetObject _ >> > ("LDAP://cn=Forest Owners,ou=Global Admins,dc=Don,dc=Corvette,dc=com") >> > objGroup.GetInfo >> > >> > arrMemberOf = objGroup.GetEx("member") >> > >> > WScript.Echo "Forest Owners" >> > For Each strMember in arrMemberOf >> > WScript.echo strMember >> > Next >> > >> > Set objGroup = GetObject _ >> > ("LDAP://cn= Service Admins,ou=Global >> > Admins,dc=Don,dc=Corvette,dc=com") >> > objGroup.GetInfo >> > >> > arrMemberOf = objGroup.GetEx("member") >> > >> > WScript.Echo "" >> > WScript.Echo "Service Admins" >> > For Each strMember in arrMemberOf >> > WScript.echo strMember >> > Next >> > >> > Set objGroup = GetObject _ >> > ("LDAP://cn=Data Admins,ou=Global Admins,dc=Don,dc=Corvette,dc=com") >> > objGroup.GetInfo >> > >> > arrMemberOf = objGroup.GetEx("member") >> > WScript.Echo "" >> > WScript.Echo "Data Admins" >> > For Each strMember in arrMemberOf >> > WScript.echo strMember >> > Next >> > >> > Set objGroup = GetObject _ >> > ("LDAP://cn=ServiceDesk Operators,ou=Global >> > Admins,dc=Don,dc=Corvette,dc=com") >> > objGroup.GetInfo >> > >> > arrMemberOf = objGroup.GetEx("member") >> > WScript.Echo "" >> > WScript.Echo "ServiceDesk Operators" >> > For Each strMember in arrMemberOf >> > WScript.echo strMember >> > Next >> > >> > Set objGroup = GetObject _ >> > ("LDAP://cn=IT_DBA,ou=Server >> > Admins,ou=Servers,dc=Don,dc=Corvette,dc=com") >> > objGroup.GetInfo >> > >> > arrMemberOf = objGroup.GetEx("member") >> > WScript.Echo "" >> > WScript.Echo "IT_DBA" >> > For Each strMember in arrMemberOf >> > WScript.echo strMember >> > Next >> > >> > ============================== >> > -- >> > Don S >> > >> > >> > "JakeDAHS" wrote: >> > >> >> On Sep 25, 1:56 pm, DSchenk952 <DSchenk***@discussions.microsoft.com> >> >> wrote: >> >> > Hi, I'm relatively new to scripting and have run a search to find a >> >> > script >> >> > that will let me feed it a list of AD Groups and extract attributes >> >> > for >> >> > all >> >> > the users in the groups. I have a small script that will let me >> >> > retrieve the >> >> > LDAP name, but would also like to extract things like LANID, Display >> >> > Name, >> >> > Group Name, EmployeeID in a table that I can sort. >> >> > >> >> > I'll continue my search but I thought I would post here to see what >> >> > may >> >> > be >> >> > available untill I find something. >> >> > >> >> > Thanks, >> >> > -- >> >> > Don S >> >> >> >> Don, >> >> >> >> Can you post the script you're currently using? >> >> >> >> -J >> >> www.pooradmin.com >> >> >> >> >> >> >> |
|||||||||||||||||||||||