Powershell Script - Export all domain users to CSV format

in microsoft •  8 years ago 

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

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!