Export (0) Print
Expand All

MSReportServer_ConfigurationSetting Class

Represents the installation and runtime 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>. Update the path to point to your installation location, if it is 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 machineWmiNamespace = @"\\<servername>\root\Microsoft\SqlServer\ReportServer\<InstanceName>\v10";
        const string wmiNamespace = @"\\<servername>\root\Microsoft\SqlServer\ReportServer\<InstanceName>\v10:MSReportServer_ConfigurationSetting";

      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();

      ManagementScope scope = null;

      scope = new ManagementScope(wmiNamespace, connOptions);
      scope.Connect();

      ManagementPath path = new ManagementPath("MSReportServer_Instance");
      ManagementClass serverClass = new ManagementClass(scope, 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.ReadKey();
      }
   }
}

Namespace: root\Microsoft\SqlServer\ReportServer\<InstanceName>\v11\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)

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft