Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to have a service running on a Windows Server 2008 R2 be able to execute dcpromo in order to join and remove AD. In Server 2003, I was able to simply use Process.Start() in C# and provide the path to dcpromo and the path to the answer file provided by a user.

However, in Server 2008, this returns FileNotFoundException. I have verified the path to dcpromo, and have even tried running other executables in the System32 folder like ipconfig and whoami which execute just fine.

The service is running as Local System account and the only way I have found to get it to work is save the command to a batch file and impersonate an Administrator to execute the batch file. But this has it's own issue like requiring an Administrator's password.

According to the permissions on the dcpromo.exe, the SYSTEM account has read/execute permissions, and I have tried giving full permissions and changed the owner to SYSTEM, but none of this helped. The same code works if ran by a user as a regular application (i.e. not a service).

Any idea how to grant SYSTEM account permissions to execute dcpromo while running under a service in Server 2008 R2?

share|improve this question
up vote -1 down vote accepted

I've been having this problem and realized that DCPromo is a 64-bit process and you probably have Visual Studio set to create x32 apps. Well, I changed VS to compile in 64-bit and it worked like a champ!


share|improve this answer

Can you change the service to run as user instead of the system account?

share|improve this answer
The problem with that is if/when it does run dcpromo to become part of a domain, the local account that it was running as disappears. The system wasn't designed for users to log in directly and so it might become difficult to change the user the service runs as. – Punkster812 Feb 7 '13 at 19:53

Your Answer


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

Not the answer you're looking for? Browse other questions tagged or ask your own question.