Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

ServerState Property

Exchange Server 2003

The ServerState property specifies the current state of the computer running Microsoft Exchange 2000 Server. The ServerState property is read-only.

Applies To

The ServerState property is a member of the ExchangeServerState Class.

Instance Path

The ServerState property appears on instances of the \\COMPUTERNAME\ROOT\cimv2\applications\exchange:ExchangeServerState class.

MOF Syntax

[Values{"Unknown", "OK", "Warning", "Error"},
 ValueMap{"0", "1", "2", "3"}] uint8 ServerState;

Qualifiers

This property has no qualifiers.

Remarks

This property value specifies the most severe value of the other ExchangeServerState State* properties. This is the same state information shown on the Monitoring and Status Properties page of the Exchange System Manager. The ServerState property is paired with the ServerStateString Property.

Property Values Map

The following table lists the ServerState allowed values.

Value NameValueDescription
Unknown0
OK1
Warning2
Error3

VBScript Example

The following example shows how to retrieve a list of ExchangeServerState instances, and how to retrieve the ServerState property.


'===============================================================
' Name:      ShowServerState_ServerState
' Purpose:   Display each ExchangeServerState found for the
'            Exchange server, and the ServerState
'            property on the ExchangeServerState instances.
' Input:     strComputerName [string] the computer to access
' Output:    Displays the name of each ExchangeServerState and
'            ServerState property.
'===============================================================
Public Sub ShowServerState_ServerState ( strComputerName )

Const cWMINameSpace = "root/cimv2/applications/exchange"
Const cWMIInstance = "ExchangeServerState"

Dim strWinMgmts              ' Connection string for WMI
Dim objWMIExchange           ' Exchange Namespace WMI object
Dim listServerStates         ' ExchangeServerState collection
Dim objExchangeServerState   ' A single ExchangeServerState object

' Create the object string, indicating WMI (winmgmts), using the
' current user credentials (impersonationLevel=impersonate),
' on the computer passed to the function in strComputerName, and
' using the CIM namespace for the ExchangeServerState provider.
strWinMgmts = "winmgmts:{impersonationLevel=impersonate}!//" & _
   strComputerName & "/" & cWMINameSpace
'
' Get an object using the string you just created.
Set objWMIExchange =  GetObject(strWinMgmts)
'
' The current state of each Exchange server is
' represented by an ExchangeServerState instance
' within the Exchange namespace.
Set listServerStates = objWMIExchange.InstancesOf(cWMIInstance)
'
' Were any ExchangeServerState instances returned?
if (listServerStates.count > 0) then
  ' If yes, do the following:
  ' Iterate through the list of ExchangeServerState objects.
  For each objExchangeServerState in listServerStates
     '
     ' Display the value of the Name property.
     WScript.echo "Name = [" & _
       TypeName(objExchangeServerState.Name) & "] " & _
      objExchangeServerState.Name
     '
     ' Display the value of the ServerState property.
     WScript.echo "    ServerState = " & _
      "[" & TypeName(objExchangeServerState.ServerState) & "] " & _
       objExchangeServerState.ServerState
     '
     '
     ' Move to the next ExchangeServerState.
  Next
else
  ' If no ExchangeServerState instances were returned,
  ' display that.
  WScript.Echo "No ExchangeServerState instances were returned."
end if
end Sub

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.