Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am using System.DirectoryServices.AccountManagement apis to create a new user/disable an account in Active Directory. When i am trying to create a new user, and set its password, m/c throws an exception with the message The RPC server is unavailable. (Exception from HRESULT: 0x800706BA). The following snippet is used to create and persist the user.

UserPrincipal user = new UserPrincipal(ctx);
user.GivenName = "Andrew";
user.Surname = "Green";
user.EmailAddress = "agreeen@gmail.com";
user.SamAccountName = "agreen";
user.Save();
user.SetPassword("Pqw^&12");
user.Save();

When i execute this, the code throws an exception as soon as it tries to set a password. After a little search on the net, I tried out the following things.

Since acct agreen gets created without password, there is no privilege or connection issue. I added Windows Management Instrumentation(WMI) as exception to the windows firewall on my AD machine I ensured that the following services RPC Endpoint Mapper, Remote Procedure Call, Remote Registry are running on the AD machine. Ensured that the account, that is used to connect to AD machine, has Enable remote Controlchecked I verified that port 135 is not blocked on AD machine The setup that i have is, I have box b1 running Microsoft Windows 7 Professional, which is trying to connect to a box b2, running Microsoft Windows Server 2008 R2 enterprise. The c# code is running on .Net4.5 framework on b1, and trying to create account on b2.

When i tried running the code from the same box(i.e. box with AD), I was able to successfully create the account with password, when i specified the ip address as localhost, but when i specified it as m/c ip address, it failed with the same exception

Please let me know what i am doing wrong.

Thanks

share|improve this question
    
Does it throw the exception on user.SetPassword, or on the (2nd) user.Save? If you install the AD management tools (specifically AD Users and Computers) on the Win7 workstation, can you successfully use the GUI to add a user with a password? –  Ƭᴇcʜιᴇ007 Aug 29 '13 at 16:03
    
it throws exception when i call user.SetPassword –  vishva Aug 31 '13 at 14:28

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.