Powershell Script - Export all domain users to CSV format

Words
21
Reading
1 min
Listen
Play
10y

In the following example the CSV will include only the field listed after select-object

Get-ADUser -Filter * -SearchBase 'OU=Users,OU=contoso,DC=com' -Properties * | Select-Object GivenName,Surname,enabled,LastLogonDate| Export-Csv C:\temp\users.csv

Powershell Script - Export all domain users to CSV format | Ecency