Skip to content

Export users from AD

There are many ways to export users from active directory, I think the easiest way is with PowerShell.

With PowerShell ‘ Get-ADuser‘ command, we can export many user’s information.

Export user’s name, Last Login date, last time set password date and save as csv file.

Get-ADUser -Filter * -Properties * -SearchBase " dc=superdoor,dc=co, dc=nz"|Select-Object Name, 
lastlogondate, passwordlastset, mail | Export-Csv -Path "c:\userinfo.csv"

When exporting users under specific OU, we need to add OU name, then we can export.

Get-ADUser -Filter * -Properties * -SearchBase "ou=nation dc=superdoor,
dc=co, dc=nz"|Select-Object
 Name, lastlogondate, passwordlastset, mail | Export-Csv -Path "c:\userinfo.csv"

Leave a Reply