ApplicationPool.GetState-Methode2

Gibt den Laufzeitstatus eines Anwendungspools zurück.

Syntax

objAppPool.GetState  
var appPoolState = appPool.GetState();  

Parameter

Diese Methode nimmt zwei Parameter entgegen.

Rückgabewert

Ein uint32, das den Status des Anwendungspools identifiziert. Die Rückgabewerte werden in der folgenden Tabelle angezeigt.

Rückgabewert BESCHREIBUNG
0 Gibt an, dass der Anwendungspool gestartet wird.
1 Gibt an, dass der Anwendungspool gestartet wurde.
2 Gibt an, dass der Anwendungspool beendet wird.
3 Gibt an, dass der Anwendungspool beendet wurde.
4 Gibt an, dass der Status des Anwendungspools unbekannt ist.

Hinweise

Diese Methode ist neu beim IIS 7-WMI-Anbieter und verfügt über kein Gegenstück in IIS 6.0.

Beispiel

Das folgende Beispiel ruft den Status eines Anwendungspools ab und gibt ihn an den Benutzer zurück.

' Connect to the WMI WebAdministration namespace.  
Set oWebAdmin = GetObject("winmgmts:root\WebAdministration")  
  
' Specify the application pool.  
Set oAppPool = oWebAdmin.Get("ApplicationPool.Name='DefaultAppPool'")  
  
' Get the application pool's state and return it to the user by  
' calling a helper function.  
WScript.Echo oAppPool.Name & " is " & GetStateDescription(oAppPool.GetState) & "."  
  
' The helper function translates the return value into text.  
Function GetStateDescription(StateCode)  
    Select Case StateCode  
        Case 0  
            GetStateDescription = "Starting"  
        Case 1  
            GetStateDescription = "Started"  
        Case 2  
            GetStateDescription = "Stopping"  
        Case 3  
            GetStateDescription = "Stopped"  
        Case 4  
            GetStateDescription = "Unknown"  
        Case Else  
            GetStateDescription = "Attempt to retrieve state failed."  
    End Select  
End Function  

Anforderungen

type Beschreibung
Client IIS 7.0 unter Windows Vista
IIS 7.5 unter Windows 7
IIS 8.0 unter Windows 8
IIS 10.0 unter Windows 10
Server IIS 7.0 unter Windows Server 2008
- IIS 7.5 unter Windows Server 2008 R2
IIS 8.0 auf Windows Server 2012.
- IIS 8.5 unter Windows Server 2012 R2
IIS 10.0 auf Windows Server 2016.
Produkt - IIS 7.0, IIS 7.5, IIS 8.0, IIS 8.5, IIS 10.0
MOF-Datei WebAdministration.mof

Weitere Informationen

ApplicationPool-Klasse