How to use dsget to export users/emails to text file?

  • Thread starter Thread starter john boy
  • Start date Start date
J

john boy

hey there,

can anyone tell me the exact syntax using dsget to export
all my domain users and their emails to a text file please?

thank ya! :-)
 
-----Original Message-----
hey there,

can anyone tell me the exact syntax using dsget to export
all my domain users and their emails to a text file please?

thank ya! :-)
.
John Boy,

I know that this is not for 'dsget' but there is a utility
out there called ldifde that is native to WIN2000. To get
a list of all of your user accounts with all of their
attributes you could simply go to a DC and enter the
following:

ldifde -f ADUsers.ldf -r "(objectClass=user)"

Did you want to restrict that list to simply the user
account and the corresponding e-mail address?

HTH,

Cary
 
Or to add what Cary said a csvde tool which as ldifde exports user info in
csv format which is IMHO more user friendly and you can directly view it in
excel ;-)

--
Regards

Matjaz Ladava, MCSE, MCSA, MCT, MVP
Microsoft MVP - Active Directory
(e-mail address removed), (e-mail address removed)
http://ladava.com
 
Matjaz,

You are correct. csvde is much more user-friendly than ldifde. I guess
that I learned ldifde first and have some affliction for it ;-)

I will try to be less 'biased' in the future! Thank you for catching me on
this.

Cary
 
Thanks all!

So, if I use CSVDE what is the syntax to export only
accounts and emails?

Thanks!
 
csvde -f yourfile.csv -r "(&(objectCategory=Person)(objectClass=user))" -l
"sAMaccountname,mail"

--
Regards

Matjaz Ladava, MCSE, MCSA, MCT, MVP
Microsoft MVP - Active Directory
(e-mail address removed), (e-mail address removed)
http://ladava.com
 
I know the main question has been answered but I'll bite and talk about the
new tools. Although I like ldifde and csvde for some uses, the ds* tools
have advantages in some situations because you don't need to know as much
about LDAP and the attributes Active Directory uses to do some common tasks.

dsget will help you get the information about one object in AD. dsquery
will help you get information about multiple objects in AD.

The following is from the help of dsget:

"To find all users with names starting with "John" and display their office
numbers:

dsquery user -name John* | dsget user -office"


dsquery user domainroot -name * | dsget user -dn -samID

gave me reasonable looking results for the DN and samAccountName of the
users in my domain. I expect

dsquery user domainroot -name * | dsget user -dn -email

would give you the results you are looking for. I don't have email address
configured in my test domain to try it on. The dsquery user
domainroot -name * will output a list of DNs which dsget uses to fetch the
properties of the object will.

Even if you decide to go with csvde, I'd suggest looking at the help for
both dsquery user /? and dsget user /? to get more info about querying
users.

Jason
 
Your commands work perfectly Jason. We just don't have in our minds......
jet. :-)

--
Regards

Matjaz Ladava, MCSE, MCSA, MCT, MVP
Microsoft MVP - Active Directory
(e-mail address removed), (e-mail address removed)
http://ladava.com
 
Thanks Matjaz!

-----Original Message-----
csvde -f yourfile.csv -r "(&(objectCategory=Person) (objectClass=user))" -l
"sAMaccountname,mail"

--
Regards

Matjaz Ladava, MCSE, MCSA, MCT, MVP
Microsoft MVP - Active Directory
(e-mail address removed), (e-mail address removed)
http://ladava.com




.
 
Back
Top