powershell - 从 Powershell 中运行 msdeploy.exe

标签 powershell msdeploy

我正在尝试从 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

docs say简单地替换 :在每个参数后面加一个 = .所以我试过这个:
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

但是,我收到错误:

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



我检查了 docs on provider settings ,但是他们没有提到他们等效的 Powershell 语法。

最佳答案

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

认为这已经回答了,只需修改它。
前任。使用变量包括“KitchenPC”和“secret”,并将 -dest 部分放在引号内。

工作示例:

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

(注意每个命令行参数周围的单引号)

关于powershell - 从 Powershell 中运行 msdeploy.exe,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12993278/

相关文章:

asp.net-mvc - 如何使用MsBuild MsDeployPublish来定位本地文件系统?

iis - 使用自动缩放最佳实践同步 aws ec2 中的 IIS 服务器

tfs - 部署后安排任务

arrays - 无法索引到数组以将其转换为哈希表

powershell - 一步拆分和修剪

windows - 写入 Windows 安全日志

asp.net - 使用 MSBUILD 和/或 MSDEPLOY (.NET 3.5) 从命令行进行部署

powershell - 尝试在CSV列表中管道导入CSV

powershell - Install-ADServiceAccount的目的

visual-studio-2010 - 401 在 MS Web 部署上