IIS 7中的应用程序池状态 [英] Application Pool Status in IIS 7

查看:313
本文介绍了IIS 7中的应用程序池状态的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想获取应用程序池的状态。我有来自这里

I want to get status of a Application Pool. I have vbscript taken from here.

strArgAppPool = Wscript.Arguments.Unnamed.Item(0)
Const noError = False

' Establish the connection to the WMI provider
Set oWebAdmin = GetObject("winmgmts:root\WebAdministration")

' Search the AppPool passed as argument in the list of application pools
Set oAppPool = oWebAdmin.Get("ApplicationPool.Name='" & strArgAppPool & "'")

' Create nice messages for pool states
Select Case oAppPool.GetState      

    Case 0            
        StateDescription = "STARTING"        
        outputStatus = "WARNING! "
        outputCode = 1
    Case 1            
        StateDescription = "STARTED"        
        outputStatus = "OK! "
        outputCode = 0
    Case 2            
        StateDescription = "STOPPING"
        outputStatus = "WARNING! "
        outputCode = 1
    Case 3            
        StateDescription = "STOPPED"        
        outputStatus = "CRITICAL!! "
        outputCode = 2
    Case 4            
        StateDescription = "UNKNOWN"        
        outputStatus = "UNKNOWN? "
        outputCode = 3
    Case Else   
        StateDescription = "UNDEFINED VALUE"    
        outputStatus = "UNKNOWN? "
        outputCode = 3

End Select

' Output
Wscript.Echo outputStatus & oAppPool.Name & ": " & StateDescription

' Error handling
If noError = true Then
    ' Error message
    Wscript.echo "UNKNOWN: Error during the WMI query for app pool " & strArgAppPool & " !"
    ' Exit & return code
    WScript.Quit(3)
Else
    ' Clean exit
    WScript.Quit(outputCode)
End If

通过批处理文件我试图将其作为

Through a batch file I am trying to run it as

status1.vbs "DefaultAppPool"

但我最终得到了这个

是不是某些服务没有启动?我试过直接运行vb脚本。我试过传递参数没有引号和所有类似的东西。我不写脚本,但必须这样做时间。

Is it some service is not started? I have tried running the vb script directly. I have tried passing arguments without quotes and all similar stuff. I don't write scripts, but got to do it this time.

错误对话框表示第5行,设置oWebAdmin = GetObject(winmgmts:root\WebAdministration) 。我在过去的5个小时内尽我所能。我有一个现成的脚本,我无法运行它。羞耻,并不愿意这一切发表这个问题。但最终输了。感谢您的帮助。

Error dialog indicates line 5, Set oWebAdmin = GetObject("winmgmts:root\WebAdministration"). I have tried everything I could in last 5 hours. I have a readymade script and I am not able to run it. Shame and was not willing post this question all this while. But lost in end. Thanks for any help.

此外,我还有一个IIS 6的工作脚本。我通过 PsExec 调用此脚本在远程服务器上。但是这在IIS 7中不起作用。如果有人要我发布,请告诉我。此外,我现在正在使用IIS 7和Server 2008 R2,并将在远程服务器上使用 PsExec 运行此脚本。

Also I have a working script for IIS 6. I am calling this script through PsExec on a remote server. But that's not working in IIS 7. Let me know if anyone want me to post it. Also I am using IIS 7 and Server 2008 R2 now and will be running this script using PsExec on remote server.

推荐答案

您没有安装角色服务 IIS管理脚本和工具。启动服务器管理器,转到 Roles→ Web服务器(IIS),并安装缺少的服务。

You don't have the role service IIS Management Scripts and Tools installed. Launch Server Manager, go to Roles → Web Server (IIS), and install the missing service.

这篇关于IIS 7中的应用程序池状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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