Solved

Script to auto populate AD field

Posted on 2013-11-14
8
661 Views
Last Modified: 2013-11-27
My managers are now looking to implement employee ID codes for all staff. Problem is that we have to do it for all existing and new staff. We have about 500 user accounts, doing it manually would be a nightmare. Is there a away for me to script something that would take an excel file containing account name + code and have the system automatically input the code into the correct AD account?
0
Comment
Question by:iamuser
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
  • 2
8 Comments
 
LVL 37

Assisted Solution

by:Mahesh
Mahesh earned 166 total points
ID: 39648303
You can create excel csv file and map all users employee code with samaccountname\logon name.
You can get employee code mapping from HR probably
Download Bulk AD users from Wisesoft.Its freeware.
It has feature called "csv update" which will allow you to update employee code attribute of all users in csv file.
Tool can be downloaded from below link.
http://wisesoft.co.uk/software/bulkadusers/default.aspx
0
 
LVL 40

Assisted Solution

by:Subsun
Subsun earned 334 total points
ID: 39648329
If you have Win 2008 R2 Domain controller then you can try..
Import-module ActiveDirectory
Import-CSV "C:\temp\Users.csv" | % {
Set-ADUser $_.User -employeeID $_.EmployeeID
} 

Open in new window

Sample Input Users.csv file format..
User,EmployeeID
UserA,1111
UserB,1112
UserC,1113

Open in new window

0
 

Author Comment

by:iamuser
ID: 39648367
Great 2 methods, with the software bulk ad user, can I use the first and last name + employee ID? Chances are HR will have it in that format rather than the username + employee ID.
0
Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

 
LVL 40

Accepted Solution

by:
Subsun earned 334 total points
ID: 39648425
By any methods you need to use the unique values to search for accounts... If you are sure that you have updated the correct first name and last name in AD as same as the HR data then you can use it to find the correct user. But keep in mind that AD allows duplicate first and last name for objects. So I would suggest you to use something like a email address or a samaccountname to find the user.
0
 
LVL 37

Expert Comment

by:Mahesh
ID: 39648440
You can map display name \ full name attribute with employee id
sAMAccountName is unique in AD, thats why I suggested you.
Anyways, i suggest you to export the user list from AD, and send it to HR in a format you want and ask them to fill up with Employee IDs
Bacause either you OR HR, somebody needs to do this mapping anyhow.
Hope that helps
0
 

Author Comment

by:iamuser
ID: 39648447
As far as I know looking at AD all users (knock on wood) have unique names

John
0
 

Author Comment

by:iamuser
ID: 39648452
Very true on that Mahesh
0
 

Author Closing Comment

by:iamuser
ID: 39681655
Thanks, great advice
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This article demonstrates probably the easiest way to configure domain-wide tier isolation within Active Directory. If you do not know tier isolation read https://technet.microsoft.com/en-us/windows-server-docs/security/securing-privileged-access/s…
In previous parts of this Nano Server deployment series, we learned how to create, deploy and configure Nano Server as a Hyper-V host. In this part, we will look for a clustering option. We will create a Hyper-V cluster of 3 Nano Server host nodes w…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

749 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