AntiMalware Status

Bulk update EmployeeID in Active Directory with PowerShell

Here is a quick [easyazon_link identifier=”B01NBI97UZ” locale=”US” tag=”wn0d5-20″] PowerShell [/easyazon_link] 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 [easyazon_link identifier=”B07CVLHK6X” locale=”US” tag=”wn0d5-20″] PowerShell [/easyazon_link] 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