Re: export to a AD Distributed group to a text
- From: "Richard Mueller" <rlmueller-NOSPAM@xxxxxxxxxxxxxxxxxxxx>
- Date: Mon, 29 May 2006 13:19:43 -0500
Ammar wrote:
I have a client who want me to export a distributed gruop members in my
Active directory to a text file ,
Thet want the members of this group to be listed with their office
attribute .
can this be done and how
Hi,
Using csvde you can use a command similar to the following (watch line
wrapping, this is all one line):
csvde -f report.txt -r (memberOf="cn=My
Group,ou=Sales,dc=MyDomain,dc=com") -l
sAMAccountName,physicalDeliveryOfficeName
You must specify the full Distinguished Name of the group for the memberOf
attribute. The sAMAccountName attribute is the NT name of the member (also
called the "pre-Windows 2000 logon name"). The LDAP display name of the
"Office" attribute is physicalDeliveryOfficeName.
In VBScript, you can bind to the group and use the Members method of the
group object to enumerate all members. For each member, you would output the
values of the attributes desired. For example:
=====================
Option Explicit
Dim objGroup, objMember
Set objGroup = GetObject("LDAP://cn=My Group,ou=Sales,dc=MyDomain,dc=com")
For Each objMember In objGroup.Members
Wscript.Echo objMember.sAMAccountName & ", " &
objMember.physicalDeliveryOfficeName
Next
=====================
If you run this at a command prompt with the cscript host, the output can be
re-directed to a text file. For example, if the above VBScript program is in
a file called ListGroup.vbs, use the following command to create a report
called output.txt:
cscript //nologo ListGroup.vbs > output.txt
The "//nologo" option suppresses logo information. The above assumes you are
currently in the directory where the file ListGroup.vbs is located -
otherwise you must specify the full path to the file.
--
Richard
Microsoft MVP Scripting and ADSI
Hilltop Lab - http://www.rlmueller.net
.
- Follow-Ups:
- Re: export to a AD Distributed group to a text
- From: Ammar
- Re: export to a AD Distributed group to a text
- Prev by Date: Re: Double Spaces in Group Name prevents export!!
- Next by Date: Re: Cannot browse an AD 2003 domain
- Previous by thread: Re: Double Spaces in Group Name prevents export!!
- Next by thread: Re: export to a AD Distributed group to a text
- Index(es):
Relevant Pages
|
Loading