Search code examples
iismsdeploy

How to work with MSDeploy through command line?


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!


Solution

  • 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.