Re: export to a AD Distributed group to a text



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


.



Relevant Pages

  • Re: WindowsPrincipal.IsInRole not working
    ... > That is an Active Directory question, but you should be able to change the ... > type of the group unless it contains members that they current group ... be a good way to start down the path of 'knowing when you should use it'! ...
    (microsoft.public.dotnet.security)
  • Re: Active Directory as a X.500 metadirectory
    ... A group object can contain other objects, ... The group object's members attribute contains the DN of each member. ... >>> Active Directory is a little new from the vantage of its implementation, ... >>> console, the containers appear empty, even though, for example the ...
    (microsoft.public.win2000.active_directory)
  • Re: Public Folder Forwarding
    ... It shows only mailbox-enabled objects when you're ... adding members. ... Multiple Contacts are configured in Active Directory ... you could set up a distribution group ...
    (microsoft.public.exchange.admin)
  • ISA server 2004 is not checking AD for groups membership of groups added in the user sets?
    ... whose only members are domain's Active Directory Users, ... same firewall policy with a user sets called "NAVIGATION BY GROUPS" ... Active Directory Groups this rule doesn't WORKS, ...
    (microsoft.public.isaserver)
  • Active Directory Only Displays Local Objects
    ... all set up as members of the domain. ... The SBS Server is the DC. ... up/restore Active Directory and restore it, ... the only thing displayed is the local computer. ...
    (microsoft.public.windows.server.active_directory)

Loading