Solved

Employee ID Update in Active Directory

Posted on 2016-08-18
2
51 Views
Last Modified: 2016-09-02
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.
0
Comment
Question by:ipsec600
2 Comments
 
LVL 21

Accepted Solution

by:
Joseph Moody earned 250 total points
Comment Utility
This script will work fine. It requires a CSV with two columns. The first should have the user's email address. The second should have the user's employee ID.

You may want to add a -whatif parameter to the end of the Set-ADUser $User.samaccountname -employeeID $ID line while you are testing this script.
0
 
LVL 8

Assisted Solution

by:Tim Edwards
Tim Edwards earned 250 total points
Comment Utility
It is going to populate the employeeID Attribute in Active Directory...

AD_attribute.PNG
and as Joseph stated
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Find out how to use Active Directory data for email signature management in Microsoft Exchange and Office 365.
Restoring deleted objects in Active Directory has been a standard feature in Active Directory for many years, yet some admins may not know what is available.
This tutorial will walk an individual through the process of transferring the five major, necessary Active Directory Roles, commonly referred to as the FSMO roles to another domain controller. Log onto the new domain controller with a user account t…
This tutorial will walk an individual through the process of configuring their Windows Server 2012 domain controller to synchronize its time with a trusted, external resource. Use Google, Bing, or other preferred search engine to locate trusted NTP …

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now