Reporting Services WMI 공급자

Reporting Services WMI 공급자는 엔터프라이즈 환경에서 제어 및 관리 정보에 액세스하기 위한 표준 WMI(Windows Management Instrumentation) 기술을 기반으로 합니다. Reporting Services용 WMI 공급자는 서버 XML 구성 요소를 클래스 집합에 매핑하는 인스턴스 공급자의 역할을 합니다. 클래스 집합에는 보고서 서버 구성 정보를 추가, 제거 또는 수정하기 위해 호출할 수 있는 메서드가 포함됩니다. 클래스에 대한 자세한 내용은 Reporting Services WMI 공급자 라이브러리를 참조하십시오.

WMI 공급자 개요

Reporting Services에는 로컬 컴퓨터와 원격 컴퓨터에서 보고서 서버 및 보고서 관리자 구성 요소를 제어하고, 네트워크에서 보고서 서버 웹 서비스를 실행 중인 컴퓨터를 확인할 수 있는 방법을 제공하고, 보고서 서버 인스턴스를 확장 배포로 활성화할 수 있도록 WMI 클래스가 포함되어 있습니다. 시스템 관리자 및 데이터베이스 관리자는 이러한 클래스를 사용하여 설치 완료 후 보고서 서버 및 보고서 관리자의 구성을 변경하거나 로컬 또는 원격 서버 관리 태스크를 수행할 수 있습니다. 태스크에는 보고서 서버와 보고서 서버 데이터베이스 간의 데이터베이스 연결 자격 증명 수정, 보고서 서버 데이터베이스의 이름 수정, 보고서 서버 인스턴스 또는 보고서 관리자의 설치 경로를 정의하는 URL 변경 등이 포함됩니다.

이러한 기능을 지원하기 위해 다음과 같은 클래스가 설치됩니다.

  • MSReportServer_Instance 클래스는 설치된 보고서 서버에 클라이언트가 연결하는 데 필요한 기본 정보를 제공합니다.

  • MSReportServer_ConfigurationSetting 클래스는 보고서 서버 인스턴스의 설치 및 런타임 매개 변수를 나타냅니다. 이러한 매개 변수는 보고서 서버에 대한 RSReportServer.config 구성 파일에 저장됩니다.

이 항목에 표시된 코드 예제의 Reporting Services에 대한 정보를 얻는 데 사용되는 네임스페이스는 System.Management 네임스페이스이며 Microsoft.NET Framework에서 찾을 수 있습니다. System.Management 네임스페이스는 .NET Framework 응용 프로그램에서 관리 정보를 액세스하고 조작하는 데 사용할 수 있는 관리 코드 클래스 집합을 제공합니다. System.Management 네임스페이스를 사용하여 Reporting Services WMI 클래스를 사용하는 방법은 Microsoft.NET Framework SDK의 "System.Management를 사용하여 관리 정보 액세스(Accessing Management Information with System.Management)"를 참조하십시오.

보고서 서버 인스턴스 찾기

컴퓨터에 보고서 서버 인스턴스가 여러 개 설치되어 있는 경우 관리자는 컴퓨터에서 수정할 속성이 속한 정확한 인스턴스를 가리켜야 합니다. 인스턴스를 직접 찾을 수 있도록 각 클래스에는 키로 정의된 속성이 포함되어 있습니다. 이 키 속성은 보고서 서버 설치를 고유하게 식별합니다. 키로 정의된 속성은 PathName 속성입니다. 이 속성의 값은 구성 파일 이름을 포함한 RSReportServer.config 구성 파일 경로입니다. 대부분 설치의 경우 이 경로는 다음 예와 유사합니다.

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

MSReportServer_ConfigurationSetting 클래스가 만들어진 후 키에 정보를 채우고 컴퓨터에서 해당 키와 일치하는 보고서 서버 또는 보고서 관리자의 인스턴스를 검색할 수 있습니다. 인스턴스를 찾으면 해당 인스턴스의 나머지 값을 관리 컬렉션에 채웁니다.

컬렉션을 채우고 관리 클래스를 반복하여 정보를 표시함으로써 정보를 얻을 수도 있습니다. Visual Studio .NET에서 이 코드를 실행하려는 경우 프로젝트 참조를 System.Management에 추가합니다. 아래 예제에서는 RSReportServer.config 구성 파일이 C:\Program Files\Microsoft SQL Server\MSRS10.<InstanceName>\Reporting Services\ReportServer\bin에 있다고 가정합니다. System.Management 클래스의 메서드에 대한 설명은 Microsoft Visual Studio .NET SDK를 참조하십시오.

보고서 서버 설치에 대한 정보를 찾을 때는 WMI 인스턴스 컬렉션을 열거하는 것이 좋습니다. 아래 예는 컬렉션을 만들고 이 컬렉션을 반복하여 속성을 표시하는 방법으로 모든 보고서 서버 인스턴스에 대한 속성을 찾는 방법을 보여 줍니다.

Imports System
Imports System.Management
Imports System.IO

Module Module1
    Sub Main()
        Const WmiNamespace As String = "\\<ServerName>\root\Microsoft\SqlServer\ReportServer\<InstanceName>\v10\Admin"
        Const WmiRSClass As String = _
           "\\<ServerName>\root\Microsoft\SqlServer\ReportServer\<InstanceName>\v10\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\<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();
    }
}

보고서 서버 및 보고서 관리자에서 읽거나 변경할 수 있는 속성에 대한 자세한 내용은 Reporting Services WMI 공급자 라이브러리를 참조하십시오. 보고서 서버 특정 속성에 대한 자세한 내용은 MSReportServer_ConfigurationSetting 클래스를 참조하십시오. 구성 파일의 기본 설치에 대한 자세한 내용은 구성 파일(Reporting Services)을 참조하십시오.