Hi,
I am using this code(.NET2.0 ) to create the user on the domain Controller
which is installed on my machine:
try {
DirectoryEntry objUsers = new DirectoryEntry
("LDAP://localhost/OU=Alcatel,DC=a lcatalnsit,DC=c om");
DirectoryEntry objNewUser = objUsers.Childr en.Add("CN=" +
"txtFirstName"+ "txtLastNam e", "user");
objNewUser.Prop erties["sAMAccountName "].Value = ("txtFirstNa me"
+"txtLastName") ;
objNewUser.Prop erties["givenName"].Value = "txtFirstNa me";
objNewUser.Prop erties["sn"].Value = "txtLastNam e";
objNewUser.Comm itChanges();
}
Catch(Exception ex)
{
Console.Writeli ne(ex.ToString( ));
}
1. on the second line it throws the exception InteropServices COMException
"The specified Directory object is not bound to a remote
resource" (and Error code property is -2147463159)
and at the catch block it writes the message
2. DirectoryServic esCOMException: A Device attached to the system is not
functioning (Exception from HRRESULT 0x8007001f)
Any Clue!!!!
Thanks & Regards
Rajnish
I am using this code(.NET2.0 ) to create the user on the domain Controller
which is installed on my machine:
try {
DirectoryEntry objUsers = new DirectoryEntry
("LDAP://localhost/OU=Alcatel,DC=a lcatalnsit,DC=c om");
DirectoryEntry objNewUser = objUsers.Childr en.Add("CN=" +
"txtFirstName"+ "txtLastNam e", "user");
objNewUser.Prop erties["sAMAccountName "].Value = ("txtFirstNa me"
+"txtLastName") ;
objNewUser.Prop erties["givenName"].Value = "txtFirstNa me";
objNewUser.Prop erties["sn"].Value = "txtLastNam e";
objNewUser.Comm itChanges();
}
Catch(Exception ex)
{
Console.Writeli ne(ex.ToString( ));
}
1. on the second line it throws the exception InteropServices COMException
"The specified Directory object is not bound to a remote
resource" (and Error code property is -2147463159)
and at the catch block it writes the message
2. DirectoryServic esCOMException: A Device attached to the system is not
functioning (Exception from HRRESULT 0x8007001f)
Any Clue!!!!
Thanks & Regards
Rajnish
Comment