Results 1 to 4 of 4

Thread: Export Group membership using script\CSVDE

  1. #1
    PK Guest

    Export Group membership using script\CSVDE

    Dear All,

    Been working on this a whole and im hitting a dead end and need a little help.

    I need to either export Group Membersip, (including several LDAP attributes
    as below)

    CSVDE -f e:\adusers.csv -r objectCategory=person -d
    "OU=myOU,DC=MyDomain,dc=co,dc=uk" -l
    "userPrincipalName,sAMAccountName,WhenCreated"

    This CSVDE script runs through and returns the specified attributes for the
    entire OU (myOU), i need to output the same information in the same format
    but by Group.

    Ideally however id like to output all users within the OU which created in
    the last 7 days (but i dont know if this is possible).

    Paul


  2. #2
    Richard Mueller [MVP] Guest

    Re: Export Group membership using script\CSVDE

    Paul wrote:

    >
    > Been working on this a whole and im hitting a dead end and need a little
    > help.
    >
    > I need to either export Group Membersip, (including several LDAP
    > attributes
    > as below)
    >
    > CSVDE -f e:\adusers.csv -r objectCategory=person -d
    > "OU=myOU,DC=MyDomain,dc=co,dc=uk" -l
    > "userPrincipalName,sAMAccountName,WhenCreated"
    >
    > This CSVDE script runs through and returns the specified attributes for
    > the
    > entire OU (myOU), i need to output the same information in the same format
    > but by Group.
    >
    > Ideally however id like to output all users within the OU which created in
    > the last 7 days (but i dont know if this is possible).


    You can export all groups in the OU and their memberships. That may be the
    same thing as your request. Use "-r (objectCategory=group)" and "-l
    sAMAccountName,member"

    This will output sAMAccountName of all groups in the OU, and Distinguished
    Names of all members. You cannot retrieve any other attributes of the
    members without a more complicated command (if at all).

    To output all users created since 20070928000000.0Z (Sept. 28, 2007, at
    00:00:00 UTC) use:

    -r
    "(&(objectCategory=person)(objectClass=user)(whenCreated>=20070928000000.0Z))"

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



  3. #3
    PK Guest

    Re: Export Group membership using script\CSVDE

    Hi Richard,

    Yes have amended as your recomendation and it works fine.

    csvde -f C:\Get-Group\report.csv -r
    "(&(objectCategory=person)(objectClass=user)(whenCreated>=20071008000000.0Z))" -l userPrincipalName,sAMAccountName -s saturn.lcbt.co.uk

    However i only need Accounts created in a specific OU how would i configure
    this..?
    Because when i insert "OU=myOU,DC=MyDomain,dc=co,dc=uk" it all stops working
    again...!

    Thanks for all you help,
    Paul

    "Richard Mueller [MVP]" wrote:

    > Paul wrote:
    >
    > >
    > > Been working on this a whole and im hitting a dead end and need a little
    > > help.
    > >
    > > I need to either export Group Membersip, (including several LDAP
    > > attributes
    > > as below)
    > >
    > > CSVDE -f e:\adusers.csv -r objectCategory=person -d
    > > "OU=myOU,DC=MyDomain,dc=co,dc=uk" -l
    > > "userPrincipalName,sAMAccountName,WhenCreated"
    > >
    > > This CSVDE script runs through and returns the specified attributes for
    > > the
    > > entire OU (myOU), i need to output the same information in the same format
    > > but by Group.
    > >
    > > Ideally however id like to output all users within the OU which created in
    > > the last 7 days (but i dont know if this is possible).

    >
    > You can export all groups in the OU and their memberships. That may be the
    > same thing as your request. Use "-r (objectCategory=group)" and "-l
    > sAMAccountName,member"
    >
    > This will output sAMAccountName of all groups in the OU, and Distinguished
    > Names of all members. You cannot retrieve any other attributes of the
    > members without a more complicated command (if at all).
    >
    > To output all users created since 20070928000000.0Z (Sept. 28, 2007, at
    > 00:00:00 UTC) use:
    >
    > -r
    > "(&(objectCategory=person)(objectClass=user)(whenCreated>=20070928000000.0Z))"
    >
    > --
    > Richard Mueller
    > Microsoft MVP Scripting and ADSI
    > Hilltop Lab - http://www.rlmueller.net
    > --
    >
    >
    >


  4. #4
    Richard Mueller [MVP] Guest

    Re: Export Group membership using script\CSVDE

    Use the -d switch to specify the root or "base" of the search:

    -d "ou=MyOU,dc=MyDomain,dc=co,dc=uk"

    You can get syntax help (with a few examples) at a command line on a DC
    with:

    csvde -?

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

    "PK" <PK@discussions.microsoft.com> wrote in message
    news:C5BD4C5F-DB7B-4726-9DFD-1E3A2DDFC39E@microsoft.com...
    > Hi Richard,
    >
    > Yes have amended as your recomendation and it works fine.
    >
    > csvde -f C:\Get-Group\report.csv -r
    > "(&(objectCategory=person)(objectClass=user)(whenCreated>=20071008000000.0Z))"
    > -l userPrincipalName,sAMAccountName -s saturn.lcbt.co.uk
    >
    > However i only need Accounts created in a specific OU how would i
    > configure
    > this..?
    > Because when i insert "OU=myOU,DC=MyDomain,dc=co,dc=uk" it all stops
    > working
    > again...!
    >
    > Thanks for all you help,
    > Paul
    >
    > "Richard Mueller [MVP]" wrote:
    >
    >> Paul wrote:
    >>
    >> >
    >> > Been working on this a whole and im hitting a dead end and need a
    >> > little
    >> > help.
    >> >
    >> > I need to either export Group Membersip, (including several LDAP
    >> > attributes
    >> > as below)
    >> >
    >> > CSVDE -f e:\adusers.csv -r objectCategory=person -d
    >> > "OU=myOU,DC=MyDomain,dc=co,dc=uk" -l
    >> > "userPrincipalName,sAMAccountName,WhenCreated"
    >> >
    >> > This CSVDE script runs through and returns the specified attributes for
    >> > the
    >> > entire OU (myOU), i need to output the same information in the same
    >> > format
    >> > but by Group.
    >> >
    >> > Ideally however id like to output all users within the OU which created
    >> > in
    >> > the last 7 days (but i dont know if this is possible).

    >>
    >> You can export all groups in the OU and their memberships. That may be
    >> the
    >> same thing as your request. Use "-r (objectCategory=group)" and "-l
    >> sAMAccountName,member"
    >>
    >> This will output sAMAccountName of all groups in the OU, and
    >> Distinguished
    >> Names of all members. You cannot retrieve any other attributes of the
    >> members without a more complicated command (if at all).
    >>
    >> To output all users created since 20070928000000.0Z (Sept. 28, 2007, at
    >> 00:00:00 UTC) use:
    >>
    >> -r
    >> "(&(objectCategory=person)(objectClass=user)(whenCreated>=20070928000000.0Z))"
    >>
    >> --
    >> Richard Mueller
    >> Microsoft MVP Scripting and ADSI
    >> Hilltop Lab - http://www.rlmueller.net
    >> --
    >>
    >>
    >>




Similar Threads

  1. CSVDE code to export without DN attribute
    By LucasYew in forum Windows Software
    Replies: 4
    Last Post: 24-04-2009, 09:29 AM
  2. Exporting member of a particular group using csvde
    By Graham in forum Active Directory
    Replies: 8
    Last Post: 27-03-2008, 06:01 PM
  3. csvde export, excluding specific OU's.
    By Vicious in forum Active Directory
    Replies: 10
    Last Post: 27-08-2007, 06:30 PM
  4. Group membership login script
    By Wooody in forum Small Business Server
    Replies: 1
    Last Post: 26-02-2007, 04:38 PM
  5. Replies: 1
    Last Post: 18-05-2006, 01:31 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,714,050,807.32964 seconds with 17 queries