Forgot to ask, is employeeID in Active Directory?
Best bet is to first dump all user Distinguished Names to a spreadsheet.
Then you can add columns as needed (with EmployeeID for example), plus
delete any users that should not be renamed (like Administrator). A program
to dump all user Distinguished Names to an Excel spreadsheet is linked here:
http://www.rlmueller.net/Create User List 3.htm
Another VBScript program can read user Distinguished Names from the
spreadsheet, rename the object, plus modify sAMAccountName to match. The
techniques for reading from the spreadsheet are demonstrated in the sample
program SetPWForUserList3.vbs linked on the page above. For your situation,
the loop that reads the spreadsheet might be similar to below, where I
assume the EmployeeID is in the second column, and the first row is skipped:
=============
intRow = 2
' Read rows from the spreadsheet until we encounter a blank in column 1.
Do While objSheet.Cells(intRow, 1).Value <> ""
' retrieve values from the spreadsheet.
strUserDN = objSheet.Cells(intRow, 1).Value
strEmployeeID = objSheet.Cells(intRow, 2).Value
' Bind to the user object.
On Error Resume Next
Set objUser = GetObject("LDAP://" & strUserDN)
If Err.Number <> 0 Then
On Error GoTo 0
Wscript.Echo "User NOT found: " & strUserDN
Else
On Error GoTo 0
' Bind to the parent container, the OU/container the user is in.
Set objParent = GetObject(objUser.Parent)
' To rename account, use MoveHere method. This changes the cn
attribute.
Set objNewUser = objParent.MoveHere(objUser.AdsPath, "cn=" &
strEmployeeID)
' Change the NT name of the user to match.
objNewUser.sAMAccountName = strEmployeeID
' Save the change to sAMAccountName.
objNewUser.SetInfo
End If
intRow = intRow + 1
Loop
===========
Even if employeeID is in Active Directory, you could dump it out in column 2
of the spreadsheet with the user DN in the first column. Better to see all
the users that will be renamed. Plus, you can test the second script on just
a few users before renaming all the rest.