本文介绍了使用PowerShell回收IIS应用程序池:“异常调用回收"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
最近的Windows更新似乎破坏了我用来回收IIS6应用程序池的某些功能,因为到目前为止,该功能已经使用了几个月.
It looks like a recent windows update has broken some functionality I was using to recycle IIS6 application pools, as this has been working for months up to today.
Exception calling "Recycle" : "Win32: The object identifier does not representException calling "Recycle" : "Win32: The object identifier does not represent a valid object.
我用来回收应用程序池的函数是:
the function I was using to recycle the application pools was:
function recycle-pool($strServerName)
{
$objWMI = [WmiSearcher] "Select * From IIsApplicationPool"
$objWMI.Scope.Path = "\\" + $strServerName + "\root\microsoftiisv2"
$objWMI.Scope.Options.Authentication = 6
$pools = $objWMI.Get()
foreach ($pool in $pools)
{
$pool.recycle()
if (!$?)
{
Write-Host $pool.name " - ERROR"
}
else
{
Write-Host $pool.name " - Recycled"
}
}
关于问题是什么以及我应该如何解决的任何想法?
Any idea on what the problem is and how I should approach this?
推荐答案
其中一个应用程序池已停止,这导致了错误.其他应用程序池被罚款回收.上面的代码可以用于其他任何人.
One of the application pools was stopped, which was causing the error. The other application pools were recycling fine. The code above is ok to use for anyone else.
这篇关于使用PowerShell回收IIS应用程序池:“异常调用回收"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!