On 2/11/08, MarvinC <[EMAIL PROTECTED]> wrote: > Our payroll department uses a process that syncs AD with their Ceridan > application. New users are manually created in AD by the helpdesk and once an > email address is generated it's passed back over to HR for further updating. > When HR gets it they add basic account info. This is the way it's been done > for years and long before my arrival. Well now there's a need to > incorporate single-sign on into the environment and the chosen app > uses the employee ID. So we need to figure out a way to import a list > of employee ID's into AD. The catch is is making sure the right ID is > assigned to the correct user. Would anyone know if this possible > through a script or custom attribute set in exchange? > > Any responses appreciated.
Your question is incredibly timely. I just did this today. Look at the comments in the vbscript program below. Generate a file with adfind that contains the data you need, then modify the script to fit your needs. Make *sure* that each and every field in the generated CSV file is surrounded with double quotes, and delimited with a comma - this script will break otherwise. Kurt ----------begin script---------- ' ************************************************************************************ ' ADUserUpload.vbs ' ' ' Intended function: ' Upload user details from testdatainput.txt in same folder as script to ' Active Directory. ' ' Sample data contained in testdatainput.txt: ' ' "dn","title","departmentNumber","employeeNumber","streetAddress","l","st","postalCode","telephoneNumber","mobile","manager" ' "CN=Burt Buff,OU=Users,OU=Test,DC=mycompany,DC=com","Test Title","12345","98765","PO Box 12345","Redmond","WA","98073","666","425.123.4567","CN=Mark Mmanager,OU=Users,OU=Test,DC=mycompany,DC=com" ' ' ************************************************************************************ Dim objFSO Dim objTextFile Dim strArray Dim blnHeaderLine Const ForReading = 1 ' Create File System Object -- Object Set objFSO = CreateObject("Scripting.FileSystemObject") ' Create File Object to input data file Set objTextFile = objFSO.OpenTextFile("testdatainput.txt", ForReading) ' Let operator know script is executing Wscript.Echo vbCrLf & "Executing Script." ' Flag header line blnHeaderLine = -1 ' Read in contents of data file. Do While objTextFile.AtEndOfStream <> True ' Read and process one line at a time strArray = objtextFile.ReadLine ' Split line into individual elements of an array Wscript.Echo vbCrLf & strArray strArray = split(strArray,chr(34) & "," & chr(34)) ' Return upper bound of array as integer value. intArrayBound = UBound(strArray) ' Remove quotation mark from each array element as needed. For intLoopCounter = 0 to intArrayBound If instr(1,strArray(intLoopCounter),chr(34)) Then strArray(intLoopCounter) = Replace(strArray(intLoopCounter),chr(34),"") End If Next ' For intLoopCounter = 0 To intArrayBound ' Wscript.echo vbcrlf & "Element: [" & intLoopCounter & "] Contains: " & strArray(intLoopCounter) ' Next ' Update AD User. Set objUser = GetObject("LDAP://" & strArray(0)) objUser.description = " " If Len(strArray(1)) > 0 Then objUser.title = strArray(1) End If If Len(strArray(2)) > 0 Then objUser.departmentNumber = strArray(2) End If If Len(strArray(3)) > 0 Then objUser.employeeNumber = strArray(3) End If If Len(strArray(4)) > 0 Then objUser.streetAddress = strArray(4) End If If Len(strArray(5)) > 0 Then objUser.l = strArray(5) End If If Len(strArray(6)) > 0 Then ObjUser.st = strArray(6) End If objUser.company = "Mycompany, Inc." If Len(strArray(7)) > 0 Then objUser.postalCode = strArray(7) End If objUser.physicalDeliveryOfficeName = "US" If Len(strArray(8)) > 0 Then objUser.telephoneNumber = strArray(8) End If If Len(strArray(9)) > 0 Then objUser.mobile = strArray(9) End If If Len(strArray(10)) > 0 Then objUser.manager = strArray(10) End If objUser.SetInfo ' Release AD objects Set objUser = Nothing Loop ' Let operator know script is complete. WScript.Echo "Done." ----------end script---------- ~ Ninja Email Security with Cloudmark Spam Engine Gets Image Spam ~ ~ http://www.sunbeltsoftware.com/Ninja ~