Set the username and password for DCOM application

comdcomscripting

Is there a way to run a script against a remote machine to enter the username and password for a specific DCOM application? Locally on the server, I can open up Command Prompt, and type:

dcomperm -runas {12345678-1234-1234-1234-00aa00bbf7c7} redmond\jdoe password

which appears to work. I tried to do it with psexec and doesnt do anything, cmd.exe gets stuck until i kill it. The command i tried is:

PsExec.exe \\Server1 -i cmd DComPerm.exe -runas {12345678-1234-1234-1234-00aa00bbf7c7} redmond\jdoe password

Doing this manually every time the application is deployed is becoming a pain and I hope there is a wiz out there that can answer the question 🙂

Best Answer

From our conversation:

You don't need to escape the backslashes in the psexec command, and you also have no need to run your dcomperm.exe executable via a command prompt. So your command should be something like

PsExec.exe \\Server1 -i DComPerm.exe -runas {12345678-1234-1234-1234-00aa00bbf7c7} redmond\jdoe password

From your testing it seems there were a few more flags to add in order for it to work correctly, so the template command is

PsExec.exe \\Servernamehere -i -s /accepteula d:/releasescripts/dcomperm.exe -runas {AppIDhere} username password

where "d:/releasescripts" is the path where dcomperm.exe is located.