Quick and dirty [easyazon_link identifier=”1449320686″ locale=”US” tag=”wn0d5-20″] PowerShell [/easyazon_link] snippet to export all [easyazon_link identifier=”1787289354″ locale=”US” tag=”wn0d5-20″] Active Directory [/easyazon_link] users with these selected attributes into CSV file where the attributes will be headers of the columns.
1 2 3 4 | Import-Module ActiveDirectory Get-ADUser -Filter * -Properties * | Select-Object SamAccountName,GivenName,Surname,DisplayName,Title,Manager,EmployeeID | Export-CSV -Path C:\Outputs\AD2Users.csv -NoTypeInformation -Encoding UTF8 |
Once you execute the script, it will create the AD2Users.csv file in same directory as is the script. You can Specify your path by adding correct export path such as [ C:\Outputs\AD2Users.csv ] or something similar. As well you can add or remove attributes you require for your export and needs.