Jump to content
Sign in to follow this  
shilpa

How to Get AppPool name and status using WMI

Recommended Posts

shilpa

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,

 

Share this post


Link to post
Share on other sites
JLogan3o13

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

 

  • Like 1

√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.