6

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.

Mike Christensen
  • 88,082
  • 50
  • 208
  • 326
  • 1
    Or consider using [Web Deploy PowerShell Cmdlets](http://www.iis.net/learn/publish/using-web-deploy/web-deploy-powershell-cmdlets). – JulianM Jan 09 '15 at 10:49

1 Answers1

5

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)

Community
  • 1
  • 1
Frode F.
  • 52,376
  • 9
  • 98
  • 114
  • Yea, I read that post already. They weren't using any provider settings, so it doesn't really apply. The solution in the blog post was basically writing a function that spawns `cmd.exe` which might be the best solution. That's too bad. – Mike Christensen Oct 20 '12 at 22:53
  • Oh I see what you're saying. [this post](http://forums.iis.net/p/1163388/1928386.aspx) helped me figure it out, and I've updated a working example to your answer. – Mike Christensen Oct 20 '12 at 23:01
  • Fantastic! So many other blog posts and responses say it's not possible or recommend kludges such as calling cmd or start-process. – ShadowChaser Jul 11 '13 at 23:25