Search code examples
powershellmsdeploy

Running msdeploy.exe from within Powershell


I'm trying to run the following command from within Powershell:

msdeploy -verb:sync -source:archiveDir=c:\KitchenPC\Build -dest:appHostConfig="KitchenPC",computerName=https://192.168.0.3:8172/msdeploy.axd,authType=Basic,userName=someuser,password="secret" -allowUntrusted

The docs say to simply substitute the : after each parameter with an =. So I've tried this:

msdeploy -verb=sync -source=archiveDir=c:\KitchenPC\Build -dest=appHostConfig="KitchenPC",computerName=https://192.168.0.3:8172/msdeploy.axd,authType=Basic,userName=someuser,password="secret" -allowUntrusted

However, I get the error:

Error: Unrecognized argument 'computerName=https://192.168.0.3:8172/msdeploy.axd'. All arguments must begin with "-". Error count: 1.

I've checked the docs on provider settings, however they have no mention of their equivelent Powershell syntax.


Solution

  • How do you call msdeploy from powershell when the parameters have spaces?

    Think this is already answered, just modify it. Ex. include "KitchenPC" and "secret" using variables, and put the -dest part inside quotation marks.

    Working Example:

    msdeploy '-verb=sync' '-source=archiveDir=c:\KitchenPC\Build -dest=appHostConfig="KitchenPC",computerName=https://192.168.0.3:8172/msdeploy.axd,authType=Basic,userName=someuser,password="secret"' -allowUntrusted
    

    (Note single quotes around each command line argument)