Export Group membership using script\CSVDE

Discussion in 'Scripting' started by PK, Oct 5, 2007.

  1. PK

    PK Guest

    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

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

    PK, Oct 5, 2007
    1. Advertisements

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

    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:

    Richard Mueller [MVP], Oct 6, 2007
    1. Advertisements

  3. PK

    PK Guest

    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
    Because when i insert "OU=myOU,DC=MyDomain,dc=co,dc=uk" it all stops working

    Thanks for all you help,
    PK, Oct 8, 2007
  4. 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

    csvde -?

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

    Richard Mueller [MVP], Oct 8, 2007
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.