InvokeMethodOptions 클래스

정의

관리 메서드 호출에 대한 옵션을 지정합니다.

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

예제

다음 예제에서는 호출 된 Win32_Process::Create calc.exe 새 프로세스를 시작 하는 방법입니다. InvokeMethodOptions 클래스 메서드를 호출 하는 데 사용 됩니다.

using System;
using System.Management;

// This sample demonstrates invoking
// a WMI method using parameter objects
public class InvokeMethod
{
    public static void Main()
    {

        // Get the object on which the method will be invoked
        ManagementClass processClass =
            new ManagementClass("Win32_Process");

        // Get an input parameters object for this method
        ManagementBaseObject inParams =
            processClass.GetMethodParameters("Create");

        // Fill in input parameter values
        inParams["CommandLine"] = "calc.exe";

        // Method Options
        InvokeMethodOptions methodOptions = new
            InvokeMethodOptions(null,
            System.TimeSpan.MaxValue);

        // Execute the method
        ManagementBaseObject outParams =
            processClass.InvokeMethod("Create",
            inParams, methodOptions);

        // Display results
        // Note: The return code of the method is
        // provided in the "returnValue" property
        // of the outParams object
        Console.WriteLine(
            "Creation of calculator process returned: "
            + outParams["returnValue"]);
        Console.WriteLine("Process ID: "
            + outParams["processId"]);
    }
}
Imports System.Management

' This sample demonstrates invoking
' a WMI method using parameter objects
Class InvokeMethod
    Public Overloads Shared Function _
        Main(ByVal args() As String) As Integer

        ' Get the object on which the
        ' method will be invoked
        Dim processClass As _
            New ManagementClass("root\CIMV2", _
            "Win32_Process", _
            Nothing)

        ' Get an input parameters object for this method
        Dim inParams As ManagementBaseObject = _
            processClass.GetMethodParameters("Create")

        ' Fill in input parameter values
        inParams("CommandLine") = "calc.exe"

        ' Method Options
        Dim methodOptions As New InvokeMethodOptions( _
            Nothing, System.TimeSpan.MaxValue)

        ' Execute the method
        Dim outParams As ManagementBaseObject = _
            processClass.InvokeMethod( _
            "Create", inParams, methodOptions)

        ' Display results
        ' Note: The return code of the method 
        ' is provided in the "returnValue" property
        ' of the outParams object
        Console.WriteLine( _
            "Creation of calculator process returned: {0}", _
            outParams("returnValue"))
        Console.WriteLine("Process ID: {0}", _
            outParams("processId"))

        Return 0
    End Function
End Class

생성자

InvokeMethodOptions()

기본값을 사용하여 InvokeMethodOptions 작업에 대한 InvokeMethod(String, Object[]) 클래스의 새 인스턴스를 초기화합니다. 이는 매개 변수가 없는 생성자입니다.

InvokeMethodOptions(ManagementNamedValueCollection, TimeSpan)

지정된 값을 사용하여 호출 작업에 대한 InvokeMethodOptions 클래스의 새 인스턴스를 초기화합니다.

속성

Context

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

(다음에서 상속됨 ManagementOptions)
Timeout

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

(다음에서 상속됨 ManagementOptions)

메서드

Clone()

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

Equals(Object)

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

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

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

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

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

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

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

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

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

(다음에서 상속됨 Object)

적용 대상