Jump to content

How to Get AppPool name and status using WMI


shilpa
 Share

Recommended Posts

Hello,

 

I am new WMI. I want to take AppPool status and name of IIS server remotely. Can you please help me to get it?

I have used  GetObject() and ApplicationPool class with Impersonation. Still it is not working.

thanks,

 

Link to comment
Share on other sites

  • Moderators

Hi, @shilpa something like this should get you the App Pool name:

Const $wbemFlagReturnImmediately = "&h10"
Const $wbemFlagForwardOnly = "&h20"

Local $sPC = "" ;Name of IIS Server
Local $oWMI = ObjGet("winmgmts:\\" & $sPC & "\root\WebAdministration")
Local $oItems = $oWMI.ExecQuery("SELECT * FROM ApplicationPool", "WQL", $wbemFlagReturnImmediately + $wbemFlagForwardOnly)

    If IsObj($oItems) Then
        If $oItems.Count <> 0 Then
            For $sApp In $oItems
                ConsoleWrite("Application: " & $oItems.Name & @CRLF & "Start Mode: " & $oItems.StartMode & @CRLF)
            Next
        EndIf
    EndIf

 

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...