ConnectionOptions 클래스

정의

WMI 연결에 필요한 모든 설정을 지정합니다.

public ref class ConnectionOptions : System::Management::ManagementOptions
public class ConnectionOptions : System.Management.ManagementOptions
type ConnectionOptions = class
    inherit ManagementOptions
Public Class ConnectionOptions
Inherits ManagementOptions
상속
ConnectionOptions

예제

다음 예제에서는 원격 컴퓨터에 연결하고 원격 컴퓨터의 운영 체제에 대한 정보를 표시합니다. 는 ConnectionOptions 기본 연결 옵션을 사용하여 원격 컴퓨터에 연결하기 위해 만들어집니다.

using System;
using System.Management;
public class RemoteConnect
{
    public static void Main()
    {
        // Build an options object for the remote connection
        // if you plan to connect to the remote
        // computer with a different user name
        // and password than the one you are currently using.
        // This example uses the default values.

        ConnectionOptions options =
            new ConnectionOptions();

        // Make a connection to a remote computer.
        // Replace the "FullComputerName" section of the
        // string "\\\\FullComputerName\\root\\cimv2" with
        // the full computer name or IP address of the
        // remote computer.
        ManagementScope scope =
            new ManagementScope(
            "\\\\FullComputerName\\root\\cimv2", options);
        scope.Connect();

        //Query system for Operating System information
        ObjectQuery query = new ObjectQuery(
            "SELECT * FROM Win32_OperatingSystem");
        ManagementObjectSearcher searcher =
            new ManagementObjectSearcher(scope,query);

        ManagementObjectCollection queryCollection = searcher.Get();
        foreach ( ManagementObject m in queryCollection)
        {
            // Display the remote computer information
            Console.WriteLine("Computer Name : {0}",
                m["csname"]);
            Console.WriteLine("Windows Directory : {0}",
                m["WindowsDirectory"]);
            Console.WriteLine("Operating System: {0}",
                m["Caption"]);
            Console.WriteLine("Version: {0}", m["Version"]);
            Console.WriteLine("Manufacturer : {0}",
                m["Manufacturer"]);
        }
    }
}
Imports System.Management
Public Class RemoteConnect

    Public Overloads Shared Function Main( _
    ByVal args() As String) As Integer

        ' Build an options object for the remote connection
        ' if you plan to connect to the remote
        ' computer with a different user name
        ' and password than the one you are currently using
        Dim options As ConnectionOptions
        options = New ConnectionOptions

        ' Make a connection to a remote computer.
        ' Replace the "FullComputerName" section of the
        ' string "\\FullComputerName\root\cimv2" with
        ' the full computer name or IP address of the
        ' remote computer.
        Dim scope As ManagementScope
        scope = New ManagementScope( _
            "\\FullComputerName\root\cimv2", options)
        scope.Connect()

        ' Query system for Operating System information
        Dim query As ObjectQuery
        query = New ObjectQuery( _
            "SELECT * FROM Win32_OperatingSystem")
        Dim searcher As ManagementObjectSearcher
        searcher = _
            New ManagementObjectSearcher(scope, query)

        Dim queryCollection As ManagementObjectCollection
        queryCollection = searcher.Get()

        Dim m As ManagementObject
        For Each m In queryCollection
            ' Display the remote computer information
            Console.WriteLine("Computer Name : {0}", _
                m("csname"))
            Console.WriteLine("Windows Directory : {0}", _
                m("WindowsDirectory"))
            Console.WriteLine("Operating System: {0}", _
                m("Caption"))
            Console.WriteLine("Version: {0}", m("Version"))
            Console.WriteLine("Manufacturer : {0}", _
                m("Manufacturer"))
        Next

        Return 0
    End Function
End Class

생성자

ConnectionOptions()

기본값을 사용하여 연결 작업에 사용할 ConnectionOptions 클래스의 새 인스턴스를 초기화합니다. 이는 매개 변수가 없는 생성자입니다.

ConnectionOptions(String, String, SecureString, String, ImpersonationLevel, AuthenticationLevel, Boolean, ManagementNamedValueCollection, TimeSpan)

새 ConnectionOption을 만듭니다.

ConnectionOptions(String, String, String, String, ImpersonationLevel, AuthenticationLevel, Boolean, ManagementNamedValueCollection, TimeSpan)

지정한 값을 사용하여 WMI 연결에 사용할 ConnectionOptions 클래스의 새 인스턴스를 초기화합니다.

속성

Authentication

이 연결 작업에 사용할 COM 인증 수준을 가져오거나 설정합니다.

Authority

지정된 사용자를 인증하는 데 사용할 인증 기관을 가져오거나 설정합니다.

Context

WMI 컨텍스트 개체를 가져오거나 설정합니다. 이것은 사용자 지정 작업에 대한 컨텍스트 정보를 지원하는 WMI 공급자에 전달될 이름/값 쌍 목록입니다.

(다음에서 상속됨 ManagementOptions)
EnablePrivileges

연결 작업을 위해 사용자 권한을 활성화해야 하는지 여부를 나타내는 값을 가져오거나 설정합니다. 이 속성은 수행된 작업(예: 컴퓨터 다시 시작)에서 특정 사용자 권한이 활성화되어야 하는 경우에만 사용합니다.

Impersonation

이 연결 작업에 사용할 COM 가장 수준을 가져오거나 설정합니다.

Locale

연결 작업에 사용할 로캘을 가져오거나 설정합니다.

Password

지정한 사용자의 암호를 설정합니다.

SecurePassword

지정한 사용자의 암호를 설정합니다.

Timeout

작업에 적용할 제한 시간을 가져오거나 설정합니다. 컬렉션을 반환하는 작업의 경우 이 시간 제한은 작업 자체가 아니라 결과 컬렉션의 열거에 적용됩니다. 작업 자체에는 ReturnImmediately 속성이 사용됩니다. 이 속성은 작업이 반동기적으로 수행되어야 함을 나타내는 데 사용됩니다.

(다음에서 상속됨 ManagementOptions)
Username

연결 작업에 사용할 사용자 이름을 가져오거나 설정합니다.

메서드

Clone()

개체의 복사본을 반환합니다.

Equals(Object)

지정된 개체가 현재 개체와 같은지 확인합니다.

(다음에서 상속됨 Object)
GetHashCode()

기본 해시 함수로 작동합니다.

(다음에서 상속됨 Object)
GetType()

현재 인스턴스의 Type을 가져옵니다.

(다음에서 상속됨 Object)
MemberwiseClone()

현재 Object의 단순 복사본을 만듭니다.

(다음에서 상속됨 Object)
ToString()

현재 개체를 나타내는 문자열을 반환합니다.

(다음에서 상속됨 Object)

적용 대상