Powershell 2.0在使用c /之后从MsDeploy运行时挂起

Son*_*Nun 1 powershell msdeploy

我试图在MSDeploy命令的preSync调用期间调用powershell,但powershell在调用之后不会退出该进程.该命令(来自命令行):"tools/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"-dest:wmsvc = BLUEPRINT-X86,username = deployer,password = deployer,dirPath = C:/ MyInstallPath

我在这里使用了一个hack(http://therightstuff.de/2010/02/06/How-We-Practice-Continuous-Integration-And-Deployment-With-MSDeploy.aspx)来获取powershell进程并将其杀死但是没用.我也尝试过taskkill和sysinternals等效,但没有任何东西可以杀死进程,以免MSDeploy出错.该命令已执行,但随后就在那里.什么可能导致powershell像这样挂起的想法?我在网络上发现了一些其他类似的问题,但没有答案.

环境是Win 2K3,使用Powershell 2.0.

更新:这是我用来调用我的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()
Run Code Online (Sandbox Code Playgroud)

epe*_*leg 5

万一有人正在寻找一个批处理文件类似的解决方案:看看这里 http://epeleg.blogspot.com/2010/06/solution-to-powershell-never-exists.html

短篇小说:使用<NUL

  • 做msdeploy.exe -verb:sync -source:runco​​mmand ="powershell -NoProfile c:\ deploy\deploy.ps1 <NUL"为我工作. (2认同)