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

Reporting Services WMI Provider

The Reporting Services WMI provider is built on standard Windows Management Instrumentation (WMI) technology for accessing control and management information in an enterprise environment. The WMI provider for Reporting Services serves as an instance provider, mapping the report server XML configuration elements to a set of classes, which include methods that you can call to add, remove, or modify report server configuration information. For more information about the classes, see Reporting Services WMI Provider Library.

WMI classes are included in Reporting Services to allow the report server and Report Manager components to be controlled on local and remote computers, to provide a way to discover which machines in the network that are running a Report Server Web service, and to activate a report server instance into a scale-out deployment. System administrators and database administrators can use these classes to make changes to the configurations of the report server and Report Manager after installation is complete, or to perform local or remote server administration tasks. Tasks include modifying the database connection credentials between the report server and the report server database, modifying the name of the report server database, and changing the URL that defines the installation path to the report server instance or Report Manager.

The classes installed to support these functions are as follows:

The namespace used to obtain information about Reporting Services in the code samples shown in this topic is the System.Management namespace, found in the Microsoft .NET Framework. The System.Management namespace provides a set of managed code classes through which .NET Framework applications can access and manipulate management information. For more information on using the Reporting Services WMI classes using the System.Management namespace, see "Accessing Management Information with System.Managment" in the Microsoft .NET Framework SDK.

If the computer has multiple instances of a report server installed, the administrator needs to point to the exact instance on the computer whose properties are being modified. To directly find the instance, each class contains a property that is defined as a key. This key property uniquely identifies a report server installation. The property defined as a key is the PathName property. The value of this property is the path to the RSReportServer.config configuration file, including the name of the configuration file. For most installations, this path would be similar to the following example:

C:\Program Files\Microsoft SQL Server\MSRS10.<InstanceName>\Reporting Services\ReportServer\rsreportserver.config

After the MSReportServer_ConfigurationSetting class is created, you can populate the key and search the computer for an instance of the report server or Report Manager that matches that key. If found, populate the management collection with the rest of the values from that instance.

You can also obtain information by populating a collection, and looping through the management class to display the information. If you are running this code from Visual Studio .NET, add a project reference to System.Management. The example below assumes that the RSReportServer.config configuration file is located in C:\Program Files\Microsoft SQL Server\MSRS10.<InstanceName>\Reporting Services\ReportServer\bin. The descriptions for the methods in the System.Management class can be found in the Microsoft Visual Studio .NET SDK.

The preferred way of finding information on your report server installations is to enumerate through the WMI instance collection. The example below shows how to find properties on every report server instance by creating a collection, and looping through the collection to display the properties.

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

class Class1
{
    [STAThread]
    static void Main(string[] args)
    {
        const string WmiNamespace = @"\\<ServerName>\root\Microsoft\SqlServer\ReportServer\<InstanceName>\v10\Admin";
        const string WmiRSClass =
          @"\\<ServerName>\root\Microsoft\SqlServer\ReportServer\<InstanceName>\v10\admin:MSReportServer_ConfigurationSetting";
        ManagementClass serverClass;
        ManagementScope scope;
        scope = new ManagementScope(WmiNamespace);

        // Connect to the Reporting Services namespace.
        scope.Connect();
        // Create the server class.
        serverClass = new ManagementClass(WmiRSClass);
        // Connect to the management object.
        serverClass.Get();
        if (serverClass == null)
            throw new Exception("No class found");

        // Loop through the instances of the server class.
        ManagementObjectCollection instances = serverClass.GetInstances();

        foreach (ManagementObject instance in instances)
        {
            Console.Out.WriteLine("Instance Detected");
            PropertyDataCollection instProps = instance.Properties;
            foreach (PropertyData prop in instProps)
            {
                string name = prop.Name;
                object val = prop.Value;
                Console.Out.Write("Property Name: " + name);
                if (val != null)
                    Console.Out.WriteLine("     Value: " + val.ToString());
                else
                    Console.Out.WriteLine("     Value: <null>");
            }
        }
        Console.WriteLine("\n--- Press any key ---");
        Console.ReadKey();
    }
}

For more information about the properties that can be read or changed on the report server and Report Manager, see Reporting Services WMI Provider Library. For more information on the properties specific to the report server, see MSReportServer_ConfigurationSetting Class. For information on the default installation of the configuration files, see Configuration Files (Reporting Services).

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.