Active Directory Throws An Error

G

Guest

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=alcatalnsit,DC=com");

DirectoryEntry objNewUser = objUsers.Children.Add("CN=" +
"txtFirstName"+"txtLastName", "user");

objNewUser.Properties["sAMAccountName"].Value = ("txtFirstName"
+"txtLastName");
objNewUser.Properties["givenName"].Value = "txtFirstName";
objNewUser.Properties["sn"].Value = "txtLastName";
objNewUser.CommitChanges();
}
Catch(Exception ex)
{
Console.Writeline(ex.ToString());
}


1. on the second line it throws the exception InteropServicesCOMException
"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. DirectoryServicesCOMException:A Device attached to the system is not
functioning (Exception from HRRESULT 0x8007001f)

Any Clue!!!!


Thanks & Regards

Rajnish
 
M

Marc Scheuner

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=alcatalnsit,DC=com");

I would try using the ACTUAL machine name, not the "virtual" localhost
name, e.g. use

LDAP://yourmachinename/OU=Alcatel,DC=alcatalnsit,DC=com

or alternatively the server name in DNS style notation, something like
this:

LDAP://yourmachinename.alcatalnsit.com/OU=Alcatel,DC=alcatalnsit,DC=com

Does this help at all?

Marc
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top