Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Script Wont write to AD

Status
Not open for further replies.

grabrail

Technical User
Aug 15, 2001
269
GB
Hi

I have a script that is supposed to write to a custom attribute in Active Directory.

The script checks for usernames in an excel spreadsheet then takes a value against that user which is an office ID.

it then finds that user in AD and writes the value to the attribute.

everything works ok up to the point where it is writing the value, it thinks it writes it ok, but doesnt do anything.

Here is a snippet of code

strDistrictOffice = currentWorkSheet.Cells(intRow, 17).Value



msgbox("District Office ID will be set to " & strDistrictOffice)


strUser = currentWorkSheet.Cells(intRow, 2).Value & " " & currentWorkSheet.Cells(intRow, 3).Value

objUser = GetObject("LDAP://cn=" & strUser & ",ou=DWPUSERS,ou=DWP," & strDomain)
msgbox("Current District ID = "& objuser.districtOfficeID)

If objUser.districtOfficeID <> strDistrictOffice Then
msgbox(strDistrictOffice)
set objUser.districtOfficeID = strDistrictOffice
objUser.setinfo
msgbox(objuser.districtOfficeID)
objTextStream.Write "OK: ID added," & strUser & "," & strDistrcitOffice

Else
objTextStream.Write "User already has district office id," & ObjUser.districtOfficeID & "," & strUser
End If

Can anybody suggest why it is not writing to the Attribute?

TIA
 
>set objUser.districtOfficeID = strDistrictOffice
[tt]objUser.districtOfficeID = strDistrictOffice[/tt]
 
Hi

Thanks for the quick response, but I have tried this.

I have also tried

objuser.pu "districtOfficeID" , strDistrictOffice.

Any other suggrestions.

Thanks
 
>I have a script that is supposed to write to a custom attribute in Active Directory.
Custom attribute: that means you've extended the ad's schema. That's the pre-requisite before you set out to manipulate the "custom attribute". Is it set up so, the custome attribute?
 
Okay. But this is incorrect.
>objUser = GetObject("LDAP://cn=" & strUser & ",ou=DWPUSERS,ou=DWP," & strDomain)
[tt][red]set[/red] objUser = GetObject("LDAP://cn=" & strUser & ",ou=DWPUSERS,ou=DWP," & strDomain)[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top