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

Service Principal Permissions for Terraform in Azure DevOps

The service Principal requires more permission on few cases in Azure. But it doesn’t apply …

Leave a Reply

Your email address will not be published.