Link to home
Start Free TrialLog in
Avatar of ipsec600
ipsec600

asked on

Employee ID Update in Active Directory

Hi Experts,

I need to update employee ID in our active directory and we have three different domain including branch offices and intend to use the same/common AD attribute for all of our domain. I have found the following power shell script to update employee ID in the active directory but not sure which available AD attribute it will use.

reference url
https://gallery.technet.microsoft.com/scriptcenter/e9bafc1a-b5b1-4663-8e25-b0d0ea28c2b2

PS script :
Import-module ActiveDirectory
Import-CSV "C:\Scripts\Users.csv" | % {
$mail = $_.mail
$ID = $_.EmployeeID
$user = Get-ADUser -Filter {mail -eq $mail}
Set-ADUser $User.samaccountname -employeeID $ID
}

Sample CSV

Users.csv
mail,employeeid
user1@test.com, 1111
user2@test.com, 2222
user3@test.com, 3333

Could you please advise the script is ok or any other PS script that I can use.
ASKER CERTIFIED SOLUTION
Avatar of Joseph Moody
Joseph Moody
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial