Posted on 2002-06-13
I'm having a problem using ADSI to change a password for a user in Active Directory from an ASP page. All users of the website must log in to the website (we use NT authentication, therefore there is an entry in Active Directory for each user). The web farm including the domain controller is behind a firewall and is separate from the domain that the users reside in. Also, I don't know if it makes a difference or not but the users are using NT4 workstations. I've written a component in VB to do this and here's the code:
Public Function ChangePassword(Username As Variant, Domain As Variant, _
OldPass As Variant, NewPass As Variant) As Variant
Dim o As IADsOpenDSObject
Dim usr As IADsUser
On Error GoTo ChangePasswordError
Set o = GetObject("WinNT:")
Set usr = o.OpenDSObject("WinNT://" & Domain & "/" & Username, Username, OldPass, 1)
usr.ChangePassword OldPass, NewPass
ChangePassword = "Ok"
ChangePassword = "Error: " & Err.Number & " " & Err.Description
Here's the code for the page I am testing this component with:
<!-- TestADSI.html -->
Dim objADSI, strMsg
Set objADSI = Server.CreateObject("ADSIUtils.Class")
strMsg = objADSI.ChangePassword("testuser","coras","Password123!","Password456!")
Set objADSI = Nothing
When I call the page, I get the following error:
Error: -2147024843 Automation error The network path was not found.
The error occurs on the Set usr = .... line but I can't find any documentation on how to solve this problem. Any help would be so greatly appreciated!!!