使用c/从MsDeploy运行时,Powershell 2.0挂起 [英] Powershell 2.0 Hang When Run From MsDeploy pre- post- ops using c/

查看:92
本文介绍了使用c/从MsDeploy运行时,Powershell 2.0挂起的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在MSDeploy命令中的preSync调用期间调用powershell,但是在调用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" -dest:wmsvc = BLUEPRINT-X86,username = deployer,password = deployer,dirPath = C:/MyInstallPath

I am trying to invoke powershell during the preSync call in a MSDeploy command, but powershell does not exit the process after it has been called. The command (from command line): "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

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

I used a hack here (http://therightstuff.de/2010/02/06/How-We-Practice-Continuous-Integration-And-Deployment-With-MSDeploy.aspx) that gets the powershell process and kills it but that didn't work. I also tried taskkill and the sysinternals equivalent, but nothing will kill the process so that MSDeploy errors out. The command is executed, but then just sits there. Any ideas what might be causing powershell to hang like this? I have found a few other similar issues around the web but no answers.

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

Environment is Win 2K3, using Powershell 2.0.

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

UPDATE: Here is a .vbs script I use to invoke my powershell command now. Invoke using '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()

推荐答案

查看

Look at the proposed solution on this site. It appears that PowerShell.exe doesn't want to exit when executed like this until its stdin has been closed by the invoking process.

这篇关于使用c/从MsDeploy运行时,Powershell 2.0挂起的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆