Export (0) Print
Expand All

MSReportServer_ConfigurationSetting Class

Represents the installation and run-time parameters of a report server instance. These parameters are stored in the configuration file for the report server.

For a list of all members of this type, see MSReportServer_ConfigurationSetting Members.

Public Class MSReportServer_ConfigurationSetting
public class MSReportServer_ConfigurationSetting

Any public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Any instance members are not guaranteed to be thread-safe.

To run the following code, add your server name in place of each <servername>. Correct the path to point to your installation location, if not the default. The following code example iterates through each property in the MSReportServer_ConfigurationSetting class, printing the name of each property and its value to the console.

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\v9\Admin";
        const string WmiRSClass =
          @"\\<servername>\root\Microsoft\SqlServer\ReportServer\v9\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();
    }
}

Namespace: root\Microsoft\SqlServer\ReportingServices\v9\Admin

Platform: Windows Server 2003, Datacenter Edition; Windows Server 2003, Enterprise Edition; Windows Server 2003, Standard Edition; Windows Vista; Windows XP Professional with Service Pack 2 (SP2) or Service Pack 1 (SP1); or Windows 2000 (all versions)

Community Additions

ADD
Show:
© 2014 Microsoft