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