Jump to content

Recommended Posts

Posted
Anyone got a way to export users from AD to a csv file. I only need the username, first name and last name. I have come across a couple of powershell scripts but wanted to see if anyone here would recommend anything.
Posted

dsquery ?

 

dsquery user "your distinguishedname" -l 0 | dsget user -samid -fn -ln > csv.txt

 

To get the ldap path just right click on an OU and select the Attribute editor, DistinguishedName

Posted
Hammer to crack a nut IMHO, I use PowerShell for many things but why reinvent the wheel when MS built-in the option to export directly from ADUC.
Posted
Click View - Add/Remove Columns, Select the Columns you need then Export the list as a CSV file.

 

Completely forgot about that thank you

 

- - - Updated - - -

 

Thanks all for the comments all sorted.

Posted
Hammer to crack a nut IMHO, I use PowerShell for many things but why reinvent the wheel when MS built-in the option to export directly from ADUC.

In this case yes, but IIRC you cannot add every field to those columns. (not in front of my PC to check)

Also if you want to pull an export from multiple OUs.

Posted

I really recommend forcing yourself to use powershell for this sort of thing. The more you use it the better at it you get. The better at it you get, the more easily you can do clever things.

 

get-aduser -Properties givenname, sn -searchbase "OU=Staff,DC=School,DC=district,DC=sch,DC=uk" |select givenname, sn, userprincipalname|export-csv -path users.csv

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...