Batch update users on Active Directory

active-directory

We have around 1000 users in the Active Directory (on Windows 2008 R2) and we would like to batch update a field (student/employee ID number) from the school management system into their existing Active Directory accounts. Obviously, each student/employee ID is unique and needs to be matched to their current Active Directory account.

How can this be done? Is there a tool available for this purpose?

Best Answer

I asume you have (or can create) a textfile with the accountname and the employeeID in it. If so you can run this command to read the file and process the changes.

for /f "tokens=1,2 delims=;" %a in (AD_EmployeeID.txt) do dsquery user -name "%a"|dsmod user -empid "%b"

The file must be in the current directory and must be named AD_EmployeeID.txt. The file must be a semicolmn seperated file where the first field is the accountname and the last is the employeeID.


e.g.

John;1234

Jane;1235


I hope this helps.

NOTE 1: if you use this command in a batchfile, replace % with %%

NOTE 2: modify delims=; if the seperator is not a semicolmn but some other character

Related Topic