Home All Groups Group Topic Archive Search About

CSVD export of SMTP addresses

Author
15 Nov 2007 9:44 PM
randy
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

Author
15 Nov 2007 9:52 PM
RemS
"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
Author
15 Nov 2007 10:05 PM
Richard Mueller [MVP]
Show quote Hide quote
"\RemS" <R***@discussions.microsoft.com> wrote in message
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

Just to elaborate, the csvde command always outputs the DN, whether you ask
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.

--
Richard Mueller
Microsoft MVP Scripting and ADSI
Hilltop Lab - http://www.rlmueller.net
--
Author
15 Nov 2007 10:06 PM
randy
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 quoteHide 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
Author
16 Nov 2007 3:15 PM
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"

\Rems

Show quoteHide 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
Author
12 Jan 2009 5:33 PM
devina
I am 38 years old and have no money. ? I have so many debts. I am a disabled experienced person and I heard that I may be qualified to receive a grant to use in conjunction with my down payment or in lieu of a down payment to assist me in home ownership. Is this true I am looking for any housing grant. Is there any one who can help me? Thank you very much. -- devina ------------------------------------------------------------------------ devina's Profile: http://forums.techarena.in/members/devina.htm View this thread: http://forums.techarena.in/server-scripting/853322.htmhttp://forums.techarena.in
Author
12 Jan 2009 11:21 PM
Pegasus (MVP)
Putting out spam messages won't win you any friends.