29.1 C
Dubai
Wednesday, October 20, 2021
spot_img

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.

Satheshwaran Manoharanhttps://www.azure365pro.com
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

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here