I am trying to create a user in vb.net 2005 via the system.directoryservices calls and I get an error that I am not able to figure out.
I am logged in as the domain administrator and am able to change properties on existing users. I have included the function I have created that is giving me the error.
The Error is:
An invalid dn syntax has been specified. (Exception from HRESULT: 0x80072032)
Public Function Create_User(ByVal deOU_To_Hold_User As System.DirectoryServices.DirectoryEntry, ByVal strSAM_ACCT As String) As System.DirectoryServices.DirectoryEntry
Dim deNew_User As DirectoryServices.DirectoryEntry
Dim deUsers_In_OU As DirectoryServices.DirectoryEntries
deUsers_In_OU = deOU_To_Hold_User.Children
deNew_User = deUsers_In_OU.Add(strSAM_ACCT, "User")
Create_User = deNew_User
Catch ex As Exception
mstrErrorText = ex.Message
Create_User = Nothing