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.
Syntax
Public Class MSReportServer_ConfigurationSetting
public class MSReportServer_ConfigurationSetting
Thread Safety
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.
Exemple
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.
Imports System
Imports System.Management
Imports System.IO
Module Module1
Sub Main()
Const WmiNamespace As String = "\\<servername>\root\Microsoft\SqlServer\ReportServer\v9\Admin"
Const WmiRSClass As String = _
"\\<servername>\root\Microsoft\SqlServer\ReportServer\v9\Admin:MSReportServer_ConfigurationSetting"
Dim serverClass As ManagementClass
Dim scope As ManagementScope
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 Is Nothing Then Throw New Exception("No class found")
'Loop through the instances of the server class.
Dim instances As ManagementObjectCollection = serverClass.GetInstances()
Dim instance As ManagementObject
For Each instance In instances
Console.Out.WriteLine("Instance Detected")
Dim instProps As PropertyDataCollection = instance.Properties
Dim prop As PropertyData
For Each prop In instProps
Dim name As String = prop.Name
Dim val As Object = prop.Value
Console.Out.Write("Property Name: " + name)
If val Is Nothing Then
Console.Out.WriteLine(" Value: <null>")
Else
Console.Out.WriteLine(" Value: " + val.ToString())
End If
Next
Next
Console.WriteLine("--- Press any key ---")
Console.ReadKey()
End Sub
End Module
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();
}
}
Requirements
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 Professionnel avec Service Pack 2 (SP2) ou Service Pack 1 (SP1) ; ou Windows 2000 (toutes versions)
Voir aussi
Référence
MSReportServer_ConfigurationSetting Members