ManagementObject.InvokeMethod メソッド (String, Object[])
アセンブリ: System.Management (system.management.dll 内)

Dim instance As ManagementObject Dim methodName As String Dim args As Object() Dim returnValue As Object returnValue = instance.InvokeMethod(methodName, args)
戻り値
メソッドが返すオブジェクト値。


Win32_Process::Create メソッドを呼び出して、Notepad.exe の新しいプロセスを開始する例を次に示します。
Imports System Imports System.Management ' This sample demonstrates invoking a WMI method ' using an array of arguments. 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("Win32_Process") ' Create an array containing all arguments ' for the method Dim methodArgs() As Object = _ {"notepad.exe", Nothing, Nothing, 0} ' Execute the method Dim result As Object = _ processClass.InvokeMethod("Create", methodArgs) ' Display results Console.WriteLine( _ "Creation of process returned: {0}", result) Console.WriteLine( _ "Process id: {0}", methodArgs(3)) Return 0 End Function End Class
using System; using System.Management; // This sample demonstrates invoking // a WMI method using an array of arguments. public class InvokeMethod { public static void Main() { // Get the object on which the // method will be invoked ManagementClass processClass = new ManagementClass("Win32_Process"); // Create an array containing all // arguments for the method object[] methodArgs = {"notepad.exe", null, null, 0}; //Execute the method object result = processClass.InvokeMethod( "Create", methodArgs); //Display results Console.WriteLine( "Creation of process returned: " + result); Console.WriteLine("Process id: " + methodArgs[3]); } }


Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


ManagementObject.InvokeMethod メソッド (String, ManagementBaseObject, InvokeMethodOptions)
アセンブリ: System.Management (system.management.dll 内)

Public Function InvokeMethod ( _ methodName As String, _ inParameters As ManagementBaseObject, _ options As InvokeMethodOptions _ ) As ManagementBaseObject
Dim instance As ManagementObject Dim methodName As String Dim inParameters As ManagementBaseObject Dim options As InvokeMethodOptions Dim returnValue As ManagementBaseObject returnValue = instance.InvokeMethod(methodName, inParameters, options)
public ManagementBaseObject InvokeMethod ( string methodName, ManagementBaseObject inParameters, InvokeMethodOptions options )
public: ManagementBaseObject^ InvokeMethod ( String^ methodName, ManagementBaseObject^ inParameters, InvokeMethodOptions^ options )
public ManagementBaseObject InvokeMethod ( String methodName, ManagementBaseObject inParameters, InvokeMethodOptions options )
public function InvokeMethod ( methodName : String, inParameters : ManagementBaseObject, options : InvokeMethodOptions ) : ManagementBaseObject
戻り値
出力パラメータと実行メソッドの戻り値を格納している ManagementBaseObject。


Win32_Process::Create メソッドを呼び出して、Calc.exe の新しいプロセスを開始する例を次に示します。
Imports System 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("Win32_Process") ' Get an input parameters object for this method Dim inParams As ManagementBaseObject = _ processClass.GetMethodParameters("Create") ' Fill in input parameter values inParams("CommandLine") = "calc.exe" ' Execute the method Dim outParams As ManagementBaseObject = _ processClass.InvokeMethod( _ "Create", inParams, Nothing) ' 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
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"; // Execute the method ManagementBaseObject outParams = processClass.InvokeMethod ("Create", inParams, null); // 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"]); } }


Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


ManagementObject.InvokeMethod メソッド

名前 | 説明 |
---|---|
ManagementObject.InvokeMethod (String, Object[]) | オブジェクトのメソッドを呼び出します。 |
ManagementObject.InvokeMethod (ManagementOperationObserver, String, Object[]) | オブジェクトのメソッドを非同期的に呼び出します。 |
ManagementObject.InvokeMethod (String, ManagementBaseObject, InvokeMethodOptions) | WMI オブジェクトのメソッドを呼び出します。入力パラメータと出力パラメータは、ManagementBaseObject オブジェクトとして表します。 |
ManagementObject.InvokeMethod (ManagementOperationObserver, String, ManagementBaseObject, InvokeMethodOptions) | オブジェクトのメソッドを非同期的に呼び出します。 |

ManagementObject.InvokeMethod メソッド (ManagementOperationObserver, String, Object[])
アセンブリ: System.Management (system.management.dll 内)

Public Sub InvokeMethod ( _ watcher As ManagementOperationObserver, _ methodName As String, _ args As Object() _ )
Dim instance As ManagementObject Dim watcher As ManagementOperationObserver Dim methodName As String Dim args As Object() instance.InvokeMethod(watcher, methodName, args)
public: void InvokeMethod ( ManagementOperationObserver^ watcher, String^ methodName, array<Object^>^ args )
public function InvokeMethod ( watcher : ManagementOperationObserver, methodName : String, args : Object[] )



Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


ManagementObject.InvokeMethod メソッド (ManagementOperationObserver, String, ManagementBaseObject, InvokeMethodOptions)
アセンブリ: System.Management (system.management.dll 内)

Public Sub InvokeMethod ( _ watcher As ManagementOperationObserver, _ methodName As String, _ inParameters As ManagementBaseObject, _ options As InvokeMethodOptions _ )
Dim instance As ManagementObject Dim watcher As ManagementOperationObserver Dim methodName As String Dim inParameters As ManagementBaseObject Dim options As InvokeMethodOptions instance.InvokeMethod(watcher, methodName, inParameters, options)
public void InvokeMethod ( ManagementOperationObserver watcher, string methodName, ManagementBaseObject inParameters, InvokeMethodOptions options )
public: void InvokeMethod ( ManagementOperationObserver^ watcher, String^ methodName, ManagementBaseObject^ inParameters, InvokeMethodOptions^ options )
public void InvokeMethod ( ManagementOperationObserver watcher, String methodName, ManagementBaseObject inParameters, InvokeMethodOptions options )
public function InvokeMethod ( watcher : ManagementOperationObserver, methodName : String, inParameters : ManagementBaseObject, options : InvokeMethodOptions )

メソッドは、指定したメソッド実行を呼び出してから、制御を戻します。進行状況と結果は、ManagementOperationObserver のイベントによってレポートされます。
.NET Framework のセキュリティ

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からManagementObject.InvokeMethodを検索する場合は、下記のリンクをクリックしてください。

- ManagementObject.InvokeMethodのページへのリンク