InvokeMethodOptions InvokeMethodOptions InvokeMethodOptions InvokeMethodOptions Class

Definición

Especifica opciones para invocar un método de administración.Specifies options for invoking a management method.

public ref class InvokeMethodOptions : System::Management::ManagementOptions
public class InvokeMethodOptions : System.Management.ManagementOptions
type InvokeMethodOptions = class
    inherit ManagementOptions
Public Class InvokeMethodOptions
Inherits ManagementOptions
Herencia
InvokeMethodOptionsInvokeMethodOptionsInvokeMethodOptionsInvokeMethodOptions

Ejemplos

En el ejemplo siguiente se invoca el método Win32_Process:: Create para iniciar un nuevo proceso de Calc. exe.The following example invokes the Win32_Process::Create method to start a new process of Calc.exe. La InvokeMethodOptions clase se usa para invocar el método.The InvokeMethodOptions class is used to invoke the method.

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

Constructores

InvokeMethodOptions() InvokeMethodOptions() InvokeMethodOptions() InvokeMethodOptions()

Inicializa una nueva instancia de la clase InvokeMethodOptions para la operación InvokeMethod(String, Object[]), mediante los valores predeterminados.Initializes a new instance of the InvokeMethodOptions class for the InvokeMethod(String, Object[]) operation, using default values. Este es el constructor sin parámetros.This is the parameterless constructor.

InvokeMethodOptions(ManagementNamedValueCollection, TimeSpan) InvokeMethodOptions(ManagementNamedValueCollection, TimeSpan) InvokeMethodOptions(ManagementNamedValueCollection, TimeSpan) InvokeMethodOptions(ManagementNamedValueCollection, TimeSpan)

Inicializa una nueva instancia de la clase InvokeMethodOptions para una operación de invocación mediante los valores especificados.Initializes a new instance of the InvokeMethodOptions class for an invoke operation using the specified values.

Métodos

Clone() Clone() Clone() Clone()

Devuelve una copia del objeto.Returns a copy of the object.

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

Determina si el objeto especificado es igual al objeto actual.Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode() GetHashCode() GetHashCode() GetHashCode()

Sirve como la función hash predeterminada.Serves as the default hash function.

(Inherited from Object)
GetType() GetType() GetType() GetType()

Obtiene el Type de la instancia actual.Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

Crea una copia superficial del objeto Object actual.Creates a shallow copy of the current Object.

(Inherited from Object)
ToString() ToString() ToString() ToString()

Devuelve una cadena que representa el objeto actual.Returns a string that represents the current object.

(Inherited from Object)

Propiedades

Context Context Context Context

Obtiene o establece un objeto de contexto WMI.Gets or sets a WMI context object. Se trata de una lista de pares de nombre y valor que se pasa a un proveedor WMI que admita información de contexto para las operaciones personalizadas.This is a name-value pairs list to be passed through to a WMI provider that supports context information for customized operation.

(Inherited from ManagementOptions)
Timeout Timeout Timeout Timeout

Obtiene o establece el tiempo de espera que se aplicará a la operación.Gets or sets the time-out to apply to the operation. Observe que, en el caso de las operaciones que devuelvan colecciones, este tiempo de espera se aplica a la enumeración a través de la colección resultante y no a la operación en sí (para esta última se usa la propiedad ReturnImmediately).Note that for operations that return collections, this time-out applies to the enumeration through the resulting collection, not the operation itself (the ReturnImmediately property is used for the latter). Esta propiedad se utiliza para indicar que la operación se debe realizar semisincrónicamente.This property is used to indicate that the operation should be performed semi-synchronously.

(Inherited from ManagementOptions)

Se aplica a