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