Solved

Employee ID Update in Active Directory

Posted on 2016-08-18
2
92 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 22

Accepted Solution

by:
Joseph Moody earned 250 total points
ID: 41761395
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
ID: 41761869
It is going to populate the employeeID Attribute in Active Directory...

AD_attribute.PNG
and as Joseph stated
0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Last week, our Skyport webinar on “How to secure your Active Directory” (https://www.experts-exchange.com/videos/5810/Webinar-Is-Your-Active-Directory-as-Secure-as-You-Think.html) provided 218 attendees with a step-by-step guide for identifying Acti…
The following article is intended as a guide to using PowerShell as a more versatile and reliable form of application detection in SCCM.
This tutorial will walk an individual through the steps necessary to join and promote the first Windows Server 2012 domain controller into an Active Directory environment running on Windows Server 2008. Determine the location of the FSMO roles by lo…
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 from a Windows Server 2008 domain controller to a Windows Server 2012 domain controlle…

808 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