3

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 :)

user185356
  • 33
  • 1
  • 3
  • How come you need to use cmd at all? PsExec will run dcomperm directly without the need for a command prompt, no? The other thing is I don't tend to escape the \ when providing the server name, it just works – john Aug 12 '13 at 20:03
  • now when I try to run dcomperm -runas {12345678-1234-1234-1234-00aa00bbf7c7} redmond\jdoe password i get invalid option specified. Not sure why it will not work locally now. I could of swore that I was able to run it earlier today. I'll try your suggestion without cmd. – user185356 Aug 12 '13 at 20:46
  • Strange, I figured out why I couldn't run the tool locally. Originally I had the command "dcomperm -runas {12345678-1234-1234-1234-00aa00bbf7c7} redmond\jdoe password" on my mac saved in textedit seems that when i was copying the command, although i don't see any formatting issues with the copied text, i needed to either copy the text and edit it on windows notepad or if i copied it from the mac, i needed to delete the space before -runas, after -runas and the same before/after the {AppID} and it works. Now the error That i see is: ERROR: Cannot open AppID registry key. Access is denied. (5) – user185356 Aug 13 '13 at 00:40
  • ERROR: Cannot open AppID registry key. Access is denied. (5) because I didn't run CMD as Administrator. Once ran as admin, the command ran without errors. – user185356 Aug 13 '13 at 00:50
  • I tested it out and the command seems to work remotely: "PsExec.exe \\Servernamehere -i -s /accepteula dcomperm.exe -runas {AppIDhere} usernamehere passwordhere". Thanks John for your help. – user185356 Aug 13 '13 at 01:25

1 Answers1

2

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.

user185356
  • 33
  • 1
  • 3
john
  • 1,995
  • 1
  • 17
  • 30