powershell - 从MsDeploy运行时,PowerShell 2.0在使用c/进行部署之前挂起

标签 powershell msdeploy

我正在尝试在MSDeploy命令中的preSync调用期间调用powershell,但是powershell在被调用后不会退出进程。
命令(从命令行):
“工具/MSDeploy/msdeploy.exe” -verb:sync -preSync:runCommand =“powershell.exe -NoLogo -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -Command C:/MyInstallPath/deploy.ps1 Set-WebAppOffline Uninstall-Service”,waitInterval = 60000 -usechecksum -source:dirPath =“build / for-deployment”-目的地:wmsvc = BLUEPRINT-X86,用户名= deployer,密码= deployer,dirPath = C:/ MyInstallPath

我在这里使用了一种hack(http://therightstuff.de/2010/02/06/How-We-Practice-Continuous-Integration-And-Deployment-With-MSDeploy.aspx),该hack获得了powershell进程并杀死了它,但是没有用。我还尝试了taskkill和sysinternals等效项,但是没有什么可以杀死该进程,从而消除了MSDeploy错误。
该命令已执行,但是就坐在那儿。有什么想法可能导致powershell像这样挂起吗?我在网上发现了其他一些类似的问题,但没有答案。

环境是使用Powershell 2.0的Win 2K3。

更新:这是我现在用来调用powershell命令的.vbs脚本。使用“cscript.exe path / to / script.vbs”调用:

Option Explicit
Dim oShell, appCmd,oShellExec
Set oShell = CreateObject("WScript.Shell")
appCmd = "powershell.exe -NoLogo -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -Command ""&{ . c:/development/materialstesting/deploy/web/deploy.ps1; Set-WebAppOffline }"" "
Set oShellExec = oShell.Exec(appCmd)
oShellExec.StdIn.Close()

最佳答案

查看proposed solution on this site。看起来PowerShell.exe像这样执行时不希望退出,直到其stdin被调用过程关闭为止。

关于powershell - 从MsDeploy运行时,PowerShell 2.0在使用c/进行部署之前挂起,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2796423/

相关文章:

asp.net - 如何将文件复制到主目录并部署

msdeploy - 将参数传递给 msdeploy runco​​mmand 中的批处理文件

powershell - Powershell Limit-EventLog OverflowAction不起作用

powershell - 如何在PowerShell中知道已安装的软件版本

powershell - 对于邮件消息中的每个文件,您可以修复吗?

c# - 无法安装 msi 包,要求 .Net framework 4

tfs - 通过 MSBuild 的 MSDeploy 的有效参数

visual-studio - 如何让 MSDeploy 将其他文件发布到 Azure?

powershell - 使用xPath的Powershell脚本中的.SelectSingleNode无法从web.config文件中提取值

regex - 使用每个文件中的特定字符串重命名目录中的多个文件