Re: Active Directory - setPassword method error

From: Sajjad Mussani (knea00_at_yahoo.com)
Date: 06/19/04


Date: Fri, 18 Jun 2004 21:16:09 -0700

The code for this error is below:

    Dim objDirEnt As New DirectoryServices.DirectoryEntry("LDAP://" &
s_ServerName, s_ADAuthUsername, s_ADAuthPassword)
        
Dim s_NewUser_User As DirectoryServices.DirectoryEntry
Try
   s_NewUser_User = objDirEnt.Children.Add("CN=" &
                                  s_UniqueCN, "user")
   With s_NewUser_User.Properties
   If s_EmployeeEmail <> "" Then .Item("mail").Value =
                                     s_EmployeeEmail
   If s_FullName <> "" Then .Item("sAMAccountName").Value =
                                     s_FullName
   End With

   s_NewUser_User.Properties("userAccountControl").Value =
                     544
   s_NewUser_User.CommitChanges()
   
   Dim s_User As DirectoryServices.DirectoryEntry
   s_User = LDAP_Connect(Me.s_PORTALLOCAL_ServerName
         & "/CN=" & s_UniqueCN
         & ",OU=ZackOU,OU=External,DC=PORTAL,DC=LOCAL",
         Me.s_PORTALLOCAL_ADAuthUsername,
         Me.s_PORTALLOCAL_ADAuthPassword)
   
   Try
       s_User.Invoke("setPassword", New Object()
            {"Password"})
   Catch e As Exception
         s_ReturnMsg = "Error in Setting Password. Error: "
              & e.ToString
   End Try
   s_User.CommitChanges()

Thanks
Knea

*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!