ManagementObject.InvokeMethod メソッドとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > ManagementObject.InvokeMethod メソッドの意味・解説 

ManagementObject.InvokeMethod メソッド (String, Object[])

オブジェクトメソッド呼び出します。

名前空間: System.Management
アセンブリ: System.Management (system.management.dll 内)
構文構文

Public Function InvokeMethod ( _
    methodName As String, _
    args As Object() _
) As Object
Dim instance As ManagementObject
Dim methodName As String
Dim args As Object()
Dim returnValue As Object

returnValue = instance.InvokeMethod(methodName, args)
public Object InvokeMethod (
    string methodName,
    Object[] args
)
public:
Object^ InvokeMethod (
    String^ methodName, 
    array<Object^>^ args
)
public Object InvokeMethod (
    String methodName, 
    Object[] args
)
public function InvokeMethod (
    methodName : String, 
    args : Object[]
) : Object

パラメータ

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]);
    }

}
.NET Framework のセキュリティ.NET Frameworkセキュリティ
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

ManagementObject.InvokeMethod メソッド (String, ManagementBaseObject, InvokeMethodOptions)

WMI オブジェクトメソッド呼び出します。入力パラメータ出力パラメータは、ManagementBaseObject オブジェクトとして表します

名前空間: System.Management
アセンブリ: 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

パラメータ

methodName

実行するメソッドの名前。

inParameters

メソッド入力パラメータ格納している ManagementBaseObject。

options

メソッド実行対す追加オプション格納している InvokeMethodOptions。

戻り値
出力パラメータ実行メソッド戻り値格納している 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"]);
    }
}
.NET Framework のセキュリティ.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 クラス
ManagementObject メンバ
System.Management 名前空間

ManagementObject.InvokeMethod メソッド (ManagementOperationObserver, String, Object[])

オブジェクトメソッド非同期的に呼び出します。

名前空間: System.Management
アセンブリ: 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,
    Object[] args
)
public:
void InvokeMethod (
    ManagementOperationObserver^ watcher, 
    String^ methodName, 
    array<Object^>^ args
)
public void InvokeMethod (
    ManagementOperationObserver watcher, 
    String methodName, 
    Object[] args
)
public function InvokeMethod (
    watcher : ManagementOperationObserver, 
    methodName : String, 
    args : Object[]
)

パラメータ

watcher

操作結果受け取オブジェクト

methodName

実行するメソッドの名前。

args

パラメータ値を格納している配列

解説解説
.NET Framework のセキュリティ.NET Frameworkセキュリティ
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

ManagementObject.InvokeMethod メソッド (ManagementOperationObserver, String, ManagementBaseObject, InvokeMethodOptions)

オブジェクトメソッド非同期的に呼び出します。

名前空間: System.Management
アセンブリ: 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
)

パラメータ

watcher

非同期実行進行状況結果処理するために使用する ManagementOperationObserver。

methodName

実行するメソッドの名前。

inParameters

メソッド入力パラメータ格納している ManagementBaseObject。

options

メソッド実行のために使用する追加オプション格納している InvokeMethodOptions。

解説解説
.NET Framework のセキュリティ.NET Frameworkセキュリティ
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

ManagementObject.InvokeMethod メソッドのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



ManagementObject.InvokeMethod メソッドのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2024 Microsoft.All rights reserved.

©2024 GRAS Group, Inc.RSS