AntiMalware Status

Bulk update EmployeeID in Active Directory with PowerShell

Here is a quick PowerShell script to run users from csv file where you have 2 columns SamAccountName and EmployeeID. Place the csv file on your local drive – in my case C:\Reports\Employee.csv.

Here is the PowerShell script to update all those employees with EmployeeID in Active Directory:

Import-Module ActiveDirectory
$Users = Import-Csv -Path C:\Reports\Employee.csv
Get-Content -Path C:\Reports\Employee.csv | ft
sleep 10
foreach ($User in $Users)
Set-ADUser -identity $User.SamAccountName -replace @{"EmployeeID" = $User.EmployeeID} -verbose

It will run trough the csv file, you will see verbose output in case there is error on your screen.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.