New Message on dotNET User Group Hyd

Active Directory Set Password Problem

Reply
  Reply to Sender   Recommend Message 1 in Discussion
From: Reji1009

I am trying to create a new user in Active Directory programatically, which I am able to do so. But finding trouble to set the password. I am getting the following Exception :
 
ex.Message >> Exception has been thrown by the target of an invocation.
ex.InnerException.Message >> The network path was not found.
I am having admin priveledges too.
 
Can anyone please tell me what is the mistake I am making.
 
Please find the Code below :
*********************************************************************

DirectoryEntry newUser = ent.Children.Add("CN="+txtName.Text, "user");

using (newUser) {

//now add properties as appropriate;

newUser.Properties["sAMAccountName"].Add(txtName.Text); // Set the SAM Account Name.

//...Set the Other Properties

newUser.CommitChanges(); // Save the Changes.

newUser.Properties["userAccountControl"].Value = 0x200; // Activate User

newUser.CommitChanges(); // Save the Changes

newUser.Invoke("Put", new object[] {"userPrincipalName", "LogonName" }); // Set the Logon Name.

newUser.CommitChanges(); // Save the Changes.

// User has to be saved prior to setting the Password. // Now  Set the Password

newUser.Invoke("SetPassword", new object[] {"Password"} ); .  << ERROR HERE

newUser.CommitChanges(); // Save the Changes.

*********************************************************************

 


View other groups in this category.

Click Here
Also on MSN:
Start Chatting | Listen to Music | House & Home | Try Online Dating | Daily Horoscopes

To stop getting this e-mail, or change how often it arrives, go to your E-mail Settings.

Need help? If you've forgotten your password, please go to Passport Member Services.
For other questions or feedback, go to our Contact Us page.

If you do not want to receive future e-mail from this MSN group, or if you received this message by mistake, please click the "Remove" link below. On the pre-addressed e-mail message that opens, simply click "Send". Your e-mail address will be deleted from this group's mailing list.
Remove my e-mail address from dotNET User Group Hyd.

Reply via email to