×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Classic asp - Only some active directory attributes can be updated.

Classic asp - Only some active directory attributes can be updated.

Classic asp - Only some active directory attributes can be updated.

(OP)
Hi

I have a classic asp script that is used to update some active directory user object attributes; email address, phone number and company name
The problem is that I am not able to write to these attributes using my script. Reading attributes works like a charme, but not able to write updates to attributes.
I have testet many things and found that certain attributes wirk as expected, but not the 3 I need.
Can anyone see what I am doing wrong??

<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

Const ADS_SECURE_AUTHENTICATION=&h0001
Const ADS_SERVER_BIND=&h0200
Const ADS_PROPERTY_UPDATE = 2

'Connect to Active directory...using user's credentials
Set objConnection = CreateObject("ADODB.Connection")
objConnection.Provider = "ADsDSOObject"
With objConnection
.Properties("User ID") = strInput_UserID
.Properties("Password") = strInput_UserPWD
.Properties("Encrypt password") = True
End With
objConnection.Open "Active Directory Provider"
Set objCommand = CreateObject("ADODB.Command")
Set objCommand.ActiveConnection = objConnection
objCommand.Properties("Searchscope") = 2
objCommand.CommandText ="select sn,name,distinguishedName,sAMAccountName FROM '"& strDomain &"' where sAMAccountname='"& strUserToEdit &"' ORDER by sAMAccountname"
Set objRecordSet = objCommand.Execute

'Reading data from AD
userdn = objRecordSet.fields("distinguishedname")
userFullname = objRecordSet.fields("name") & " " & objRecordSet.fields("sn")
arrPath = Split(userdn, ",",2)
strOUdn = arrPath(1)
strUserOU = "LDAP://mydomain.no/" & strOUdn

'Time to write som information to AD ----- the problem section -------

Set objIADS = GetObject("WinNT:").OpenDSObject("WinNT://mydomain.no/", strAdminUser, strAdminPWD, ADS_SECURE_AUTHENTICATION + ADS_SERVER_BIND)
Set objIADSUser = objIADS.GetObject("user", strInput_UserID)

If Err.Number = 0 Then
On Error Resume next
With objIADSUser
'-------------------------------------------------------------------------------------------
'------------------- These 5 work just fine -----------
'-------------------------------------------------------------------------------------------
.SetPassword strRndPassword
.AccountDisabled = False
.IsAccountLocked = False
.Put "PasswordExpired", CLng(1)
.put "description", "My description"

'-------------------------------------------------------------------------------------------
'------------------- The following 3 attributes I am not able to update/write to -----------
'-------------------------------------------------------------------------------------------
' .put "mail" = "test@email.com"
' .put "telephoneNumber", "7775555333"
' .put "company", "MyCompanyName"

.SetInfo
End With
End If[/color][/color]

RE: Classic asp - Only some active directory attributes can be updated.

What error do you get?

RE: Classic asp - Only some active directory attributes can be updated.

(OP)
Error Number is: -2147463153

RE: Classic asp - Only some active directory attributes can be updated.

(OP)
Error Number is: 424

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close