It dies at CommitChanges which is like SetInfo in ADSI. I didn't manage to get any 
sort of error code out. Seems to be in die with any combination mode. I may just have 
to get out netmon tomorrow if I don't have some sort of ephiphany between now and 
tomorrow morning <g>. 
 
--Brian

        -----Original Message----- 
        From: joe [mailto:[EMAIL PROTECTED] 
        Sent: Sun 8/29/2004 10:43 PM 
        To: [EMAIL PROTECTED] 
        Cc: 
        Subject: RE: [ActiveDir] Constraint Exception
        
        

        Where exactly is it dying?
        
        Does it work for other combinations of attributes?
        
        Have you looked at the extended error info from the error? Not sure how to do 
that with COM but you can get a network trace and pull it from that. It may possibly 
give you an attribute it is choking on and a DSID.
        
        I don't know NET, is the &H2 simply a way of saying the integer 2? I.E. Is 
that line clearing the disabled bit?
        
          joe
        
        
        -----Original Message-----
        From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Brian Desmond
        Sent: Sunday, August 29, 2004 9:21 PM
        To: [EMAIL PROTECTED]
        Subject: [ActiveDir] Constraint Exception
        
        My provisioning utility has taken to blasting constraint exceptions from COM 
with the following block of attributes. It seems to be borking on this combination, 
but I don't see the problem. I have checked twice, I have no students by this name 
enrolled. It was working a couple hours ago too. Code is below too.
        
        manager: LDAP://CN=Brian Desmond,OU=Tech 
Dept,OU=Accounts,DC=payton,DC=cps,DC=k12,DC=il,DC=us
        description: Student
        initials: C
        givenname: Captain
        displayname: Captain C. Cheese
        homedirectory: \\hydrogen\studentfolders\cheesec
        homedrive: U:
        samaccountname: cheesec
        scriptpath: apps.bat
        pwdlastset: 0
        userprincipalname: [EMAIL PROTECTED]
        sn: Cheese
        employeeid: 12345678
        division: 901
        
        
                Public Shared Function CreateUser(ByVal ParentDN As String, ByVal Cn 
As String, ByVal attributes As StringDictionary, ByVal Password As String) As String
                    Dim parent As New DirectoryEntry("LDAP://"; & ParentDN)
        
                    Dim user As DirectoryEntry = parent.Children.Add("cn=" & Cn, 
"user")
        
                    For Each attr As String In attributes.Keys
                        If Not attributes(attr) = "" Then
                            user.Properties(attr).Value = attributes(attr)
                            Debug.WriteLine(attr & ": " & attributes(attr))
                        End If
                    Next
        
                    user.CommitChanges()
        
                    user.Invoke("SetPassword", New Object() {Password})
        
                    user.Properties("userAccountControl").Value = 
CType(user.Properties("userAccountControl").Value, Integer) Xor &H2
                    If attributes.ContainsKey("pwdLastSet") Then
                        user.Properties("pwdLastSet").Value = 0
                    End If
                    If attributes.ContainsKey("accountExpires") Then
                        user.Invoke("AccountExpirationDate", New Object() 
{CType(attributes("accountExpires"), DateTime)})
                    End If
                    user.CommitChanges()
        
                    Return CType(user.Properties("distinguishedName").Value, String)
                End Function
            End Class
        
        
        
        Does anyone see what is wrong with this data?
        
        --Brian
        ..jjryãv
        
        List info   : http://www.activedir.org/mail_list.htm
        List FAQ    : http://www.activedir.org/list_faq.htm
        List archive: http://www.mail-archive.com/activedir%40mail.activedir.org/
        

<<winmail.dat>>

Reply via email to