This documentation is archived and is not being maintained.

InvokeMethodOptions Class

Specifies options for invoking a management method.

For a list of all members of this type, see InvokeMethodOptions Members.


[Visual Basic]
Public Class InvokeMethodOptions
   Inherits ManagementOptions
public class InvokeMethodOptions : ManagementOptions
public __gc class InvokeMethodOptions : public ManagementOptions
public class InvokeMethodOptions extends ManagementOptions

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.


using System; 
using System.Management; 

// This example demonstrates how to stop a system service. 
class Sample_InvokeMethodOptions 
    public static int Main(string[] args) {
        ManagementObject service = 
            new ManagementObject("win32_service=\"winmgmt\"");
        InvokeMethodOptions options = new InvokeMethodOptions();
        options.Timeout = new TimeSpan(0,0,0,5); 

        ManagementBaseObject outParams = service.InvokeMethod("StopService", null, options);

        Console.WriteLine("Return Status = " + outParams["ReturnValue"]);

        return 0;
[Visual Basic] 
Imports System
Imports System.Management

' This sample demonstrates how to stop a system service.
Class Sample_InvokeMethodOptions
    Overloads Public Shared Function Main(args() As String) As Integer
        Dim service As New ManagementObject("win32_service=""winmgmt""")
        Dim options As New InvokeMethodOptions()
        options.Timeout = New TimeSpan(0, 0, 0, 5)
        Dim outParams As ManagementBaseObject = service.InvokeMethod( _
            "StopService", _
            Nothing, _

        Console.WriteLine("Return Status = " & _
        Return 0
    End Function
End Class

[C++, JScript] No example is available for C++ or JScript. To view a Visual Basic or C# example, click the Language Filter button Language Filter in the upper-left corner of the page.


Namespace: System.Management

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

Assembly: System.Management (in System.Management.dll)

See Also

InvokeMethodOptions Members | System.Management Namespace