|
server
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
CSVD export of SMTP addresses
I am attempting to export a list of all usernames and smtp email addresses
fromt LDAP. I have the following command which works, except for the fact that it keeps exporting the Distinguished name, even though I don't ask it to do so. Is there a way where I can limit it to just export the two fields I want? csvde -r "(objectClass=user)" -d "ou=accounting,ou=domain user accounts,dc=corp,dc=domain,dc=com" -l "cn,mail" -f c:\email.csv "randy" wrote: Use DSQuery.exe instead of csvde,
http://www.petri.co.il/forums/showthread.php?t=18464&highlight='Saved%20Queries> I am attempting to export a list of all usernames and smtp email addresses > fromt LDAP. I have the following command which works, except for the fact > that it keeps exporting the Distinguished name, even though I don't ask it to > do so. Is there a way where I can limit it to just export the two fields I > want? > > csvde -r "(objectClass=user)" -d "ou=accounting,ou=domain user > accounts,dc=corp,dc=domain,dc=com" -l "cn,mail" -f c:\email.csv Or use a vbscript, http://www.petri.co.il/forums/showthread.php?t=19411 \Rems Show quote
"\RemS" <R***@discussions.microsoft.com> wrote in message Just to elaborate, the csvde command always outputs the DN, whether you ask news:42C4C20C-4547-4BE1-9F93-3755237D41A8@microsoft.com... > "randy" wrote: > >> I am attempting to export a list of all usernames and smtp email >> addresses >> fromt LDAP. I have the following command which works, except for the fact >> that it keeps exporting the Distinguished name, even though I don't ask >> it to >> do so. Is there a way where I can limit it to just export the two fields >> I >> want? >> >> csvde -r "(objectClass=user)" -d "ou=accounting,ou=domain user >> accounts,dc=corp,dc=domain,dc=com" -l "cn,mail" -f c:\email.csv > > Use DSQuery.exe instead of csvde, > http://www.petri.co.il/forums/showthread.php?t=18464&highlight='Saved%20Queries > > Or use a vbscript, > http://www.petri.co.il/forums/showthread.php?t=19411 > > \Rems for it or not. The reason is that DN uniquely identifies the objects. Note that the cn attribute does not. There could be several objects in the domain with the same value assigned to cn, they just need to be in different OU's or containers. Another attribute that will uniquely identify the users (in the domain) is sAMAccountName (pre-Windows 2000 logon name). That might be a better choice. I have tried this command, however it results in returning names from all
ou's, how can I limit to specifc OU's for searching? cmd /c dsquery.exe * -limit 0 -filter "(&(objectCategory=person)(objectClass=user)(mail=*))" -attr name mail Show quote >"c:\PrimaryEmailAddresses.txt" "\RemS" wrote: > "randy" wrote: > > > I am attempting to export a list of all usernames and smtp email addresses > > fromt LDAP. I have the following command which works, except for the fact > > that it keeps exporting the Distinguished name, even though I don't ask it to > > do so. Is there a way where I can limit it to just export the two fields I > > want? > > > > csvde -r "(objectClass=user)" -d "ou=accounting,ou=domain user > > accounts,dc=corp,dc=domain,dc=com" -l "cn,mail" -f c:\email.csv > > Use DSQuery.exe instead of csvde, > http://www.petri.co.il/forums/showthread.php?t=18464&highlight='Saved%20Queries > > Or use a vbscript, > http://www.petri.co.il/forums/showthread.php?t=19411 > > \Rems enter the DN of the ou as <startnode>.
http://www.jsifaq.com/SF/Tips/Tip.aspx?id=7330 The DN must be between quotes. And maybe? you might also want to use the parameter: -scope onelevel cmd /c dsquery.exe * "OU=name3,OU=name2,OU=name1,DC=domain,DC=local" -scope onelevel -limit 0 -filter "(&(objectCategory=person)(objectClass=user)(mail=*))" -attr name mail >"c:\PrimaryEmailAddresses.txt" \RemsShow quote "randy" wrote: > I have tried this command, however it results in returning names from all > ou's, how can I limit to specifc OU's for searching? > > cmd /c dsquery.exe * -limit 0 -filter > "(&(objectCategory=person)(objectClass=user)(mail=*))" -attr name mail > >"c:\PrimaryEmailAddresses.txt" > > "\RemS" wrote: > > > "randy" wrote: > > > > > I am attempting to export a list of all usernames and smtp email addresses > > > fromt LDAP. I have the following command which works, except for the fact > > > that it keeps exporting the Distinguished name, even though I don't ask it to > > > do so. Is there a way where I can limit it to just export the two fields I > > > want? > > > > > > csvde -r "(objectClass=user)" -d "ou=accounting,ou=domain user > > > accounts,dc=corp,dc=domain,dc=com" -l "cn,mail" -f c:\email.csv > > > > Use DSQuery.exe instead of csvde, > > http://www.petri.co.il/forums/showthread.php?t=18464&highlight='Saved%20Queries > > > > Or use a vbscript, > > http://www.petri.co.il/forums/showthread.php?t=19411 > > > > \Rems |
|||||||||||||||||||||||