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

PowerShell を呼び出し

[PowerShell を呼び出し] アクティビティです。[PowerShell を呼び出し] アクティビティは、指定された入力パラメーターを使用して PowerShell コマンドまたはスクリプトを実行します。

UiPath.Core.Activities.InvokePowerShell

説明

[PowerShell を呼び出し] アクティビティは、指定された入力パラメーターを使用して PowerShell コマンドまたはスクリプトを実行します。

注:

PowerShell アクセスを制限するウイルス対策ポリシーにより、PowerShell 関連のアクティビティの使用が妨げられる場合があります。たとえば、McAfee Endpoint Security でルール ID 6151 が有効化されている場合、[ワークフロー ファイルを呼び出し][Power Shell を呼び出し] を使用することはできません。

プロジェクトの対応 OS

Windows - レガシ |Windows

構成

  • CommandText - The PowerShell command to be executed. This value can be the name of a cmdlet or the text of a PowerShell Script.

プロパティ パネル

共通

  • エラー発生時に実行を継続 - アクティビティが例外をスローした場合でもオートメーションを続行するかどうかを指定します。このフィールドは 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 Power Shell activity. You can reference piped input in a script by using $input.
    注:

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

オプション

  • IsScript - コマンド テキストがスクリプトか直接コマンドかを指定します。 パイピング、変数、およびパラメーターは、単一のコマンドまたはスクリプトで使用できます。
  • Execution Mode - Select a version of PowerShell in which to execute the command or script provided. This is only available for Windows projects, Windows-Legacy projects target Windows PowerShell 5.1 (32-bit) version. The following options are available:
    • PowerShell 7.2.15 (64-bit) - Uses PowerShell Core shell based on .NET6. In this version, PowerShell is hosted within the .NET 6 runtime. Any data used is directly accessible by the activity, and can be imported in the workflow.
    • 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内にラップされます。PSObjectPSCustomObjects は、元のオブジェクトの全体的な構造に関する情報を保持し、オブジェクトを手動で再構築するために使用できます。
  • PowerShellVariables - A dictionary of named objects that represent variables used within the current session of the Invoke Power Shell 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.
    注:

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

  • Current type - Sets the type of the objects returned in Output.

その他

  • プライベート - オンにした場合、変数および引数の値が 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 Power Shell activities.
  • 説明
  • プロジェクトの対応 OS
  • 構成
  • プロパティ パネル
  • 共通
  • 入力
  • オプション
  • その他
  • 出力

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

接続

ヘルプ リソース サポート

学習する UiPath アカデミー

質問する UiPath フォーラム

最新情報を取得