I am Dale Hayter, a Microsoft and VMware certified Technical Consultant.

My blog has been built up over the years from my experience of working on an IT helpdesk and also from being out on-site.

Powershell – Get List of All Users in Active Directory

If you wish to get a list of all users from your active directory. You can do this with 1 simple powershell command. You need to run this in Active Directory Module for Windows Powershell on one of your DC’s.

Get-ADUser -Filter * -SearchBase "dc=domain,dc=local"

This will export the list of users and all their detail. In my particular case I wanted to just retrieve the Name of the users and their SID. SO I used the command below.

Get-ADUser -Filter * -SearchBase "dc=domain,dc=local" | select Name,SID

You can then export this to a CSV by adding | Export-CSV c:\temp\Sids.csv to the end.

Get-ADUser -Filter * -SearchBase "dc=domain,dc=local" | select Name,SID | Export-CSV