PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Forums Hébergement > Forum Hébergement serveur > ms.win.server.scripting > List Users and Attributes in Multiple Groups
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
List Users and Attributes in Multiple Groups

Réponse
 
LinkBack Outils de la discussion
Vieux 25/09/2007, 18h56   #1
DSchenk952
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut 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
  Réponse avec citation
Vieux 25/09/2007, 21h19   #2
JakeDAHS
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: List Users and Attributes in Multiple Groups

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

  Réponse avec citation
Vieux 25/09/2007, 21h46   #3
DSchenk952
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: List Users and Attributes in Multiple Groups

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
>
>

  Réponse avec citation
Vieux 25/09/2007, 22h40   #4
Richard Mueller [MVP]
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: List Users and Attributes in Multiple Groups

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" <DSchenk952@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
>>
>>



  Réponse avec citation
Vieux 26/09/2007, 00h58   #5
DSchenk952
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: List Users and Attributes in Multiple Groups

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" <DSchenk952@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
> >>
> >>

>
>
>

  Réponse avec citation
Vieux 26/09/2007, 02h43   #6
Richard Mueller [MVP]
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: List Users and Attributes in Multiple Groups

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.

--
Richard Mueller
Microsoft MVP Scripting and ADSI
Hilltop Lab - http://www.rlmueller.net
--

"DSchenk952" <DSchenk952@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" <DSchenk952@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
>> >>
>> >>

>>
>>
>>



  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 10h13.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,22046 seconds with 14 queries