0

I want to run a .bat file on my server via MSDeploy from remote. I installed the remote agent service on the server and started it. Also installed MSdeploy on my computer.

Now I want to execute the bat file from remote.

Can anyone help me out? Thanks, any help will be upvoted immediately!

RayofCommand
  • 4,054
  • 17
  • 56
  • 92

2 Answers2

1

You're looking for the runCommand provider:

msdeploy.exe -verb:sync ^
              -source:runCommand="path\to\batch.bat" ^
              -dest:auto,computerName=serverName,userName=user,password=pass

This will automatically transfer the batch file to the remote server as long as it is named .bat or .cmd and you do not pass any parameters to it.

Community
  • 1
  • 1
Richard Szalay
  • 83,269
  • 19
  • 178
  • 237
  • thank you! but now i receive an error : could not complete the request to remote agent URL .....error : the name = expires part of the cookie is invalid. - Do you have an idea? – RayofCommand Aug 29 '13 at 08:37
  • my destination computer has 2 names one Computer Name and one Full Computer Name. Hmm – RayofCommand Aug 29 '13 at 08:48
-1

It sounds like you are trying to execute the bat file on one machine from another machine? If so have you considered PsExec from Sysinternals? http://technet.microsoft.com/en-us/sysinternals/bb897553

Mike Cheel
  • 12,626
  • 10
  • 72
  • 101