Freigeben über


GetServerStatus Method (WMI MSReportServer_Instance)

Returns server status information to determine if the report server is ready to handle requests.

Syntax

Public Sub GetServerStatus(ByRef Names() As String, ByRef Statuses()_
    As String, ByRef Descriptions() As String, ByRef Severities() As _
    Int32, ByRef Length As Int32, ByRef HRESULT As Int32)

public void GetServerStatus(out string Names[], out string Statuses[],
    out string Descriptions[], out sint32 Severities[],
    out sint32 Length, out sint32 HRESULT);

Parameters

  • Names[]
    An array containing the names of the settings.
  • Statuses[]
    An array containing the status of the settings.
  • Descriptions[]
    An array containing descriptions for each setting's status.
  • Severities[]
    An array containing the severity levels of each setting's status.
  • Length
    An integer value containing the length of the arrays returned.
  • HRESULT
    A value indicating success or an error code.

Return Values

GetServerStatus checks the configuration of several settings on the report server and returns a matched set of arrays containing status information.

GetServerStatus returns an HRESULT indicating success or failure of the method call. A value of 0 indicates that the report server instance was successfully activated. If the activation was not successful, one of the following errors is returned:

Error message

ACT_E_CANT_CONNECT_CATALOG

ACT_E_SERVICE_NOT_ACTIVATED

ACT_E_SERVICE_DISABLED

ACT_E_UNEXPECTED_DB_ERROR

ACT_E_UNEXPECTED_DB_RESULT

ACT_E_ALREADY_ACTIVATED

ACT_E_NOT_ANNOUNCED

ACT_E_NOT_ADMIN

ACT_E_DB_IMPERSONATE_ERROR

ACT_E_CRYPT_IMPERSONATE_ERROR

ACT_E_CRYPT_EXPORT_ERROR

Hinweise

Methods exposed by WMI management objects are called through the InvokeMethod function. For more information, please see "Executing Methods on Management Objects" in the Microsoft .NET Framework WMI documentation.

Beispiel

The following code sample displays the configuration settings for all report server instances on the specified machine.


using System;
using System.Management;
using System.IO;
[assembly: CLSCompliant(true)]

class Class1
{
    [STAThread]
    static void Main(string[] args)
    {
        const string machineWmiNamespace = 
           @"\\localhost\root\Microsoft\SqlServer\ReportServer\v9";
  
        ConnectionOptions connOptions = new ConnectionOptions();
        connOptions.Authentication = AuthenticationLevel.Default;

        ObjectGetOptions getOptions = new ObjectGetOptions();
        getOptions.Timeout = new System.TimeSpan(0, 0, 30);

        ManagementScope machineScope = 
           new ManagementScope(machineWmiNamespace, connOptions);
        machineScope.Connect();

        ManagementPath path = 
           new ManagementPath("MSReportServer_Instance");
        ManagementClass serverClass = 
           new ManagementClass(machineScope, path, getOptions);

        serverClass.Get();

        ManagementObjectCollection instances = 
          serverClass.GetInstances();

        foreach (ManagementObject instance in instances)
        {
            Console.WriteLine("\n-----\nSERVER STATUS:\n");

            ManagementBaseObject serverStatusObject =
              instance.InvokeMethod("GetServerStatus", null, null);

            int t = (int)serverStatusObject["Length"];

            Array namesArray = (Array)serverStatusObject["Names"];
            Array descArray = 
              (Array)serverStatusObject["Descriptions"];
            Array statusArray = 
              (Array)serverStatusObject["Statuses"];
            Array severityArray = 
              (Array)serverStatusObject["Severities"];

            for (int i = 0; i < t; i++)
            {
                Console.WriteLine("{0} - {1}",
                   (string)namesArray.GetValue(i), 
                      (string)descArray.GetValue(i));
                Console.WriteLine("Value: {0}, Severity: {1}",
                   (string)statusArray.GetValue(i), 
                      (int)severityArray.GetValue(i));
            }

            Console.WriteLine("\n--- Press any key ---");
            Console.ReadKey();

        }
    }
}

Requirements

Namespace:root\Microsoft\SqlServer\ReportServer\v9

Platform: Windows Server 2003 Datacenter Edition, Windows Server 2003 Enterprise Edition, Windows Server 2003 Standard Edition, Windows Vista, Windows XP Professional mit Service Pack 2 (SP2) bzw. Service Pack 1 (SP1) oder Windows 2000 (alle Versionen)

Siehe auch

Verweis

MSReportServer_ConfigurationSetting Members

Hilfe und Informationen

Informationsquellen für SQL Server 2005