Improve company productivity with a Business Account.Sign Up

x
?
Solved

Employee ID Update in Active Directory

Posted on 2016-08-18
2
Medium Priority
?
712 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 1000 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 11

Assisted Solution

by:Tim Edwards
Tim Edwards earned 1000 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

In this article, we will discuss how you can secure Active Directory using free tools, and how you can choose a safe and secure Active Directory security auditing tool.
Assume that as a role of System Administrator in SMB (or a startup group), you are requested to (re)design the IT infrastructure of the company. In this article, I will describe the steps of design, configure and operate the IT devices in a small bu…
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…

589 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