Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

2 Answers 2

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

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!

Carlos

share|improve this answer

Your Answer

 
discard

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.