UiPath Documentation
activities
latest
false
ワークフローのアクティビティ
重要 :
このコンテンツの一部は機械翻訳によって処理されており、完全な翻訳を保証するものではありません。 新しいコンテンツの翻訳は、およそ 1 ~ 2 週間で公開されます。

Invoke PowerShell

Invoke PowerShell activity that executes a PowerShell command or script with specified input parameters.

UiPath.Core.Activities.InvokePowerShell

説明​

The Invoke PowerShell activity executes a PowerShell command or script with specified input parameters.

注:

Antivirus policies that restrict PowerShell access may prevent the use of PowerShell-related activities. For example, you cannot use Invoke Workflow File and Invoke PowerShell when rule ID 6151 is enabled in McAfee Endpoint Security.

プロジェクトの対応 OS​

Windows - レガシ |Windows

構成​

  • コマンド テキスト - 実行する PowerShell コマンドです。この値には、コマンドレットの名前または PowerShell スクリプトのテキストを指定できます。

プロパティ パネル​

共通​

  • エラー発生時に実行を継続 - アクティビティでエラーが発生した場合でもオートメーションを続行するかどうかを指定します。このフィールドは Boolean 値 (True、False) のみをポートします。既定値は False です。結果として、フィールドが空白であり、エラーが返された場合、プロジェクトの実行は停止されます。値が True に設定されている場合、エラーが発生したとしても、プロジェクトの実行は続行されます。
    注:

    このアクティビティが [トライ キャッチ] に含まれており、[エラー発生時に実行を継続] プロパティの値が True である場合は、プロジェクトの実行時にエラーはキャッチされません。

  • 表示名 - アクティビティの表示名です。

入力​

  • Parameters - PowerShell のコマンド パラメーターの辞書です。 特定のコマンド (コマンドレット) またはスクリプトを使用できます。
    • 特定のコマンド: 特定のコマンドを呼び出すときは、パラメーターの名前がコマンドのパラメーターの名前と一致する必要があります。

たとえば、入力として Get-Command -Module CimCmdlets を使用する場合、入力値は Get-Command である必要があります。また、パラメーターには Module という名前を付け、値を "CimCmdlets" に設定する必要があります。

  • スクリプト: スクリプトの先頭で、パラメーターの種類を指定する必要があります。 必要に応じて、パラメーターを必須にして、呼び出し元によって設定されたパラメーターでスクリプトが常に呼び出されるように強制することもできます。

たとえば、次のスクリプトには 2 つのパラメーターがあります。1 つは [string] 型、もう 1 つは [int] 型です。

Param(
  [Parameter(Mandatory=$true)]
  [string]$Name,
  [int]$Age
)
Param(
  [Parameter(Mandatory=$true)]
  [string]$Name,
  [int]$Age
)

これらのパラメーターは、パラメーター名の前に $ を追加することで、スクリプトで参照できます。

  • Input - A collection of PSObjects that are passed to the writer of the pipeline used to execute the command. Can be the output of another Invoke PowerShell activity. You can reference piped input in a script by using $input.
    注:

    この変数は、PowerShell によって暗黙的に作成されます。input という名前の変数またはパラメーターを定義すると、エラーが生成されたり、競合が発生したりする可能性があります。inputという用語は配管用に予約することをお勧めします。

オプション​

  • IsScript - コマンド テキストがスクリプトか直接コマンドかを指定します。 パイピング、変数、およびパラメーターは、単一のコマンドまたはスクリプトで使用できます。
  • Execution mode - 指定されたコマンドまたはスクリプトを実行する PowerShell のバージョンを選択します。 これは Windows プロジェクトでのみ利用可能です。Windows - レガシ プロジェクトの対象は Windows PowerShell 5.1 (32 ビット) バージョンです。 次のオプションが利用できます。
    • PowerShell 7.2.15 (64 ビット) - .NET6ベースの PowerShell Core シェルを使用します。このバージョンでは、PowerShell は .NET 6 ランタイム内でホストされます。使用するデータは、アクティビティから直接アクセスでき、ワークフローにインポートできます。
    • PowerShell 5.1 (64 ビット) - 64 ビットの Windows PowerShell 実行可能ファイルを使用します。このバージョンでは、PowerShell は Windows にバンドルされており、既定で Windows にありますC:\Windows\System32\WindowsPowerShell\v1.0\この実行モードでは、PowerShell はプレインストールされたシェルを使用してマシン上でローカルにリモート化されます。リモート処理では、異なる .NET ランタイム間で情報をシリアル化および逆シリアル化する必要が生じるため、再構築できないオブジェクトは PSObject または PSCustomObject内にラップされます。
    • PowerShell 5.1 (32 ビット) - 32 ビットの Windows PowerShell 実行可能ファイルを使用します。このバージョンでは、PowerShell は Windows にバンドルされており、既定で C:\Windows\SysWOW64\WindowsPowerShell\v1.0\にあります。この実行モードでは、PowerShell はプレインストールされたシェルを使用してマシン上でローカルにリモート化されます。リモート処理では、異なる .NET ランタイム間で情報をシリアル化および逆シリアル化する必要が生じるため、再構築できないオブジェクトは PSObject または PSCustomObject内にラップされます。PSObject と PSCustomObjects は、元のオブジェクトの全体的な構造に関する情報を保持し、オブジェクトを手動で再構築するために使用できます。
  • PowerShellVariables - A dictionary of named objects that represent variables used within the current session of the Invoke PowerShell activity. A PowerShell command or script can retrieve information from In and In/Out variables and can set Out variables. To reference variables in your script, use the variable identifier character $ to denote that the text after is a variable name. Example: $firstVariable.
    注:

    変数名では大文字と小文字が区別されません。

  • 現在の型 - [出力] で返されるオブジェクトの型を設定します。

その他​

  • プライベート - オンにした場合、変数および引数の値が Verbose レベルでログに出力されなくなります。

出力​

  • Output - A collection of objects of the type set in Current type, returned by the execution of the command. Can be used to pipe several Invoke PowerShell activities.
  • 説明​
  • プロジェクトの対応 OS​
  • 構成​
  • プロパティ パネル​
  • 共通​
  • 入力​
  • オプション​
  • その他​
  • 出力​

このページは役に立ちましたか?

接続

ヘルプ リソース サポート

学習する UiPath アカデミー

質問する UiPath フォーラム

最新情報を取得