Ok.. This one is driving me crazy! I am trying to solve a problem for our developers. I'm no programmer but I made a basic page to update the description field of a test user in AD. I want to have my credentials to pass through this page to make the AD changes ( I am a domain admin).
This page works if I make the following changes in IIS:
- I setup myself as the anonymous user and click on the page.
- It also works if I turn on just basic authentication and log in when prompted.
- When I pass my user info through the OpenDSObject() function.
This page does not work when I:
- Just enable Windows Integrated Authentication.
- Set the OpenDSObject() username and password to NULL which is supposed to pass the caller's credenitals.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/adsi/adsi/iadsopendsobject_opendsobject.aspThings I have done:
- I have changed the Metabase to NTAuthenticationProviders=
"Negotiate
,NTLM"
- All this stuff:
http://www.microsoft.com/technet/prodtechnol/windowsserver2003/technologies/security/kerbnlb.mspxAny help with this would be much appreciated!
CODE:
<%
strContainer = "cn=Users"
strName = "john smith"
Const ADS_PROPERTY_CLEAR = 1
Const ADS_PROPERTY_UPDATE = 2
Const ADS_PROPERTY_APPEND = 3
Const ADS_PROPERTY_DELETE = 4
Const ADS_SECURE_AUTHENTICATION = 1
'*************************
**********
**********
**
'* Connect to an object *
'*************************
**********
**********
**
oUsername=vbNullString
oPassword=vbNullString
Set objRootDSE = GetObject("LDAP://rootDSE"
)
Set openDS = GetObject("LDAP:")
If strContainer = "" Then
Set objItem = GetObject("LDAP://" & _
objRootDSE.Get("defaultNam
ingContext
"))
Else
Response.Write "LDAP://cn=" & strName & "," & strContainer & "," & objRootDSE.Get("defaultNam
ingContext
") & "<br>"
Set objItem = openDS.OpenDSObject("LDAP:
//cn=" & strName & "," & strContainer & "," & objRootDSE.Get("defaultNam
ingContext
"),oUserna
me,oPasswo
rd,ADS_SEC
URE_AUTHEN
TICATION)
End If
'*************************
**********
**********
**
'* End connect to an object *
'*************************
**********
**********
**
Response.Write "Was: <BR>"
Response.Write objItem.DisplayName & "<BR>"
Response.Write objItem.Description & "<BR>"
Response.Write "<BR>"
objItem.Put "givenName", "John"
objItem.SetInfo
objItem.Put "initials", "JS"
objItem.SetInfo
objItem.Put "sn", "Smith"
objItem.SetInfo
objItem.Put "displayName", "John Smith"
objItem.SetInfo
objItem.Put "description", "Generated by ADTEST1"
objItem.SetInfo
objItem.Put "physicalDeliveryOfficeNam
e", "DALLAS"
objItem.SetInfo
objItem.Put "telephoneNumber", "214-555-1212"
objItem.SetInfo
objItem.Put "mail", "jsmith@xxx.com"
objItem.SetInfo
objItem.Put "wWWHomePage", " "
objItem.SetInfo
Response.Write "Now: <BR>"
Response.Write objItem.DisplayName & "<BR>"
Response.Write objItem.Description & "<BR>"
objItem.PutEx ADS_PROPERTY_UPDATE, "otherTelephone", _
Array("VALUE1", "VALUE2", "...VALUEn")
objItem.SetInfo
objItem.PutEx ADS_PROPERTY_UPDATE, "url", _
Array("VALUE1", "VALUE2", "...VALUEn")
objItem.SetInfo
objItem.Put "streetAddress", "123 Main Street"
objItem.SetInfo
objItem.Put "l", " "
objItem.SetInfo
objItem.Put "st", "TX"
objItem.SetInfo
objItem.Put "postalCode", "75201"
objItem.SetInfo
'Response.Write VbCrLf & "**Non-standard value on Address Properties Page**"
'See Script Notes for information on setting this value.
'objItem.Put "c", "1"
'objItem.SetInfo
objItem.PutEx ADS_PROPERTY_UPDATE, "postOfficeBox", _
Array("VALUE1", "VALUE2", "...VALUEn")
objItem.SetInfo
objItem.Put "profilePath", " "
objItem.SetInfo
objItem.Put "scriptPath", " "
objItem.SetInfo
objItem.Put "homeDirectory", " "
objItem.SetInfo
'See Script Notes for information on setting this value.
objItem.Put "homeDrive", " "
objItem.SetInfo
objItem.Put "homePhone", "214-555-1212"
objItem.SetInfo
objItem.Put "pager", "214-555-1212"
objItem.SetInfo
objItem.Put "mobile", "214-555-1212"
objItem.SetInfo
objItem.Put "facsimileTelephoneNumber"
, "214-555-1212"
objItem.SetInfo
objItem.Put "ipPhone", "214-555-1212"
objItem.SetInfo
objItem.Put "info", "214-555-1212"
objItem.SetInfo
objItem.PutEx ADS_PROPERTY_UPDATE, "otherHomePhone", _
Array("VALUE1", "VALUE2", "...VALUEn")
objItem.SetInfo
objItem.PutEx ADS_PROPERTY_UPDATE, "otherPager", _
Array("VALUE1", "VALUE2", "...VALUEn")
objItem.SetInfo
objItem.PutEx ADS_PROPERTY_UPDATE, "otherMobile", _
Array("VALUE1", "VALUE2", "...VALUEn")
objItem.SetInfo
objItem.PutEx ADS_PROPERTY_UPDATE, "otherFacsimileTelephoneNu
mber", _
Array("VALUE1", "VALUE2", "...VALUEn")
objItem.SetInfo
objItem.PutEx ADS_PROPERTY_UPDATE, "otherIpPhone", _
Array("VALUE1", "VALUE2", "...VALUEn")
objItem.SetInfo
objItem.Put "title", "Computer User"
objItem.SetInfo
objItem.Put "department", "IT"
objItem.SetInfo
objItem.Put "company", "XXX"
objItem.SetInfo
'See Script Notes for information on setting this value.
objItem.Put "manager", " "
objItem.SetInfo
objItem.SetInfo
%>