Active Directory Throws An Error

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • rkaushik

    Active Directory Throws An Error

    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



  • Marc Scheuner

    #2
    Re: Active Directory Throws An Error

    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");
    I would try using the ACTUAL machine name, not the "virtual" localhost
    name, e.g. use

    LDAP://yourmachinename/OU=Alcatel,DC=a lcatalnsit,DC=c om

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

    LDAP://yourmachinename .alcatalnsit.co m/OU=Alcatel,DC=a lcatalnsit,DC=c om

    Does this help at all?

    Marc

    Comment

    Working...