Export CSV using Employee ID in Active Directory

When you have only employee ID as input in CSV. lets see how to export the appropriate Active directory accounts to a csv file with employeeID,displayName,givenName,sn,sAMAccountName, mail, Department. You can always modify the scripts to get desired output.

Import-csv c:\employeeids.csv | ForEach-Object {
$ID = $_.employeeID
get-aduser -filter {employeeid -eq $ID} -Properties * | select-object employeeID,displayName,givenName,sn,sAMAccountName, mail, Department | Export-csv empo.csv -Append

Save as ps1 and update the CSV file location.

About Satheshwaran Manoharan

Satheshwaran Manoharan is an Microsoft Office Server and Services MVP , Publisher of Azure365pro.com. Specialized in Office365 / Microsoft Exchange / Virtualization , Sathesh is an Messaging Expert supporting/Designing/Deploying many medium size businesses to large enterprises when it comes to Corporate messaging and Virtualization Infrastructure

Check Also

Adding [EXTERNAL] for emails with Auto Remove on Reply

In the world of spam and the number of phishing emails is increasing day by …

Leave a Reply

Your email address will not be published.