locked
extracting contacts sips from AD into text file.. how to eliminate spaces? RRS feed

  • Question

  •  

    I had stumbled onto this one liner for getting contact info from AD:

     

    dsquery * "OU=Domain Users,DC=domain,DC=local" -attr msRTCSIP-PrimaryUserAddress -scope onelevel -limit 10000 > contactsTEST.txt

     

     

    Has anyone found a way to trim this automatically without user intervention?

     

    Thanks

    Thursday, January 3, 2008 10:12 PM

All replies

  •  

    I guess noone has found a way.. cant find much googling either...

     

     

    Wednesday, January 9, 2008 9:01 PM
  • I'm not sure what problem you are having, but why not just use csvde to export those attribute values?

     

    Code Block
    csvde -s SERVER.DOMAIN.COM -f EXPORTFILENAME.csv -l "DN,objectClass,cn,msRTCSIP-PrimaryUserAddress," -r "(&(objectClass=user)(objectCategory=person))"

     

     

     

    Wednesday, January 9, 2008 10:36 PM
    Moderator
  •  Jeff Schertz wrote:

    I'm not sure what problem you are having, but why not just use csvde to export those attribute values?

     

    Code Block
    csvde -s SERVER.DOMAIN.COM -f EXPORTFILENAME.csv -l "DN,objectClass,cn,msRTCSIP-PrimaryUserAddress," -r "(&(objectClass=user)(objectCategory=person))"

     

     

     

     

     

    I end up with :

     

    ------------

    sip:user1

     

    sip:user2

    sip:user3

     

    sip:user4

    ------------

     

    note the spaces here and there.. and the wsf script doesnt like them.

     

     

    Thursday, January 10, 2008 2:58 PM
  • Then use the csvde command I posted, import the CSV file input Excel and clean up the columns into the desired format.

     

    I have some info in this blog post about formatting the CSV file that might help as well.

     

     

    Thursday, January 10, 2008 3:41 PM
    Moderator