使用Powershell或命令行启动/停止App Pool IIS6.0 [英] Start/Stop App Pool IIS6.0 with Powershell or command line
本文介绍了使用Powershell或命令行启动/停止App Pool IIS6.0的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用IIS 6.0,正在寻找一种停止/启动应用程序池的方法.我知道7.0中有一个用于powershell的stop-appPool,但使用的是6.0. :-(那么,有没有人会使用Powershell脚本或另一个命令行exe来停止/启动应用程序池?
I'm using IIS 6.0 and looking for a way to stop/start the app pool. I know there is a stop-appPool for powershell in 7.0 but using 6.0. :-( So does anyone have a powershell script or another command line exe that will stop/start the app pool?
谢谢.
推荐答案
好的,我只是添加了一个开关来停止应用程序池,否则它会启动,因为启动已经启动的应用程序池没有任何危害:>
Ok here it is, I just add a switch to stop the app pool else it starts since no harm in starting an app pool that is already started:
param([string]$appPoolName, [switch]$stop)
$appPool = get-wmiobject -namespace "root\MicrosoftIISv2" -class "IIsApplicationPool" | where-object {$_.Name -eq "W3SVC/AppPools/$appPoolName"}
if($appPool)
{
if($stop)
{
$appPool.Stop()
}
else
{
$appPool.Start()
}
}
这篇关于使用Powershell或命令行启动/停止App Pool IIS6.0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文