---
schema_version: "1"
id: 26f4e5d49623302c3d34693d1abe181b1d57079d2f9299056e5367082402906d
title: Microsoft Windows PowerShell Connector
collection: mulesoft
version: current
locale: ja-jp
portal_url: https://docs.salesforce.com/mulesoft/current/ja-jp/windows-powershell-connector/2/index.md
canonical_url: https://docs.mulesoft.com/jp/windows-powershell-connector/2/
source_site: docs.mulesoft.com
content_type: documentation
content_hash: 44a6fc8bfb20fa5561080f2e799a6da2ed3f21ea9eb976e6c6b6010849131c1b
description: MuleSoft Documentation Site
release: "2"
latest: false
---
# Microsoft Windows PowerShell Connector

Microsoft Windows PowerShell Connector バージョン 2.0

Microsoft Windows PowerShell 用 Anypoint Connector (PowerShell コネクタ) を使用すると、Windows の管理タスクを Mule アプリケーションに統合できます。PowerShell コネクタにより、任意のマシンにローカルまたはリモートで接続し、それらのマシン上でスクリプトファイルやコマンドを実行できるようになります。SSH を使用して PowerShell のスクリプトをリモートの Windows または Linux (Ubuntu) マシン上で実行し、結果を Mule Runtime Engine (Mule) 内で処理することができます。

<table><tbody><tr><td class="icon"><i class="fa icon-note" title="Note"></i></td><td class="content">コネクタは、MacOS コンピューターでの PowerShell スクリプトの実行をサポートしていません。</td></tr></tbody></table>

互換性と解決された問題に関する情報は、​[「Microsoft Powershell コネクタリリースノート」](https://docs.mulesoft.com/jp/release-notes/connector/microsoft-powershell-connector-release-notes-mule-4)​を参照してください。

## [](#始める前に)始める前に

このコネクタを使用するには、以下に精通している必要があります。

- Anypoint Connector
- Mule Runtime Engine (Mule)
- Mule フローの要素
- グローバル要素
- Anypoint Studio を使用した Mule アプリケーションの作成方法

PowerShell コネクタを操作するには、先に SSH サーバーを Windows または Linux (Ubuntu) のリモートマシンにインストールする必要があります。

- Windows  
    
    1. [Win32 または Win64 用 OpenSSH](https://github.com/PowerShell/Win32-OpenSSH/releases)​ をダウンロードします。
    2. [OpenSSH のインストール手順](https://github.com/PowerShell/Win32-OpenSSH/wiki/Install-Win32-OpenSSH)​に従います。
- Linux (Ubuntu)  
    
    1. [SSH のインストール手順](https://help.ubuntu.com/lts/serverguide/openssh-server.html)​に従います。
    2. Microsoft の [「Linux への PowerShell のインストール手順」](https://docs.microsoft.com/en-us/powershell/scripting/install/installing-powershell-core-on-linux?view=powershell-6)​に従います。

## [](#pom-ファイルの連動関係の追加)POM ファイルの連動関係の追加

```xml
<dependency>
  <groupId>com.mulesoft.connectors</groupId>
  <artifactId>mule-powershell-connector</artifactId>
  <version>x.x.x</version>
  <classifier>mule-plugin</classifier>
</dependency>
```

コネクタの ​`version`​ が、使用しているバージョンと一致していることを確認します。

最新の ​`pom.xml`​ ファイル情報を取得する手順は、次のとおりです。

1. [Anypoint Exchange](https://www.mulesoft.com/exchange/)​ に移動します。
2. Exchange で、​**\[Login (ログイン)\]**​ をクリックし、Anypoint Platform のユーザー名とパスワードを指定します。
3. Exchange で、「​`powershell`​」を検索します。
4. **\[Dependency Snippets (連動関係スニペット)\]**​ をクリックします。

## [](#studio-でコネクタに追加する)Studio でコネクタに追加する

PowerShell コネクタを Mule プロジェクトに追加すると、XML コードにコネクタの名前空間とスキーマの場所が自動的に入力され、プロジェクトの ​`pom.xml`​ ファイルに必要な連動関係が追加されます。

1. Anypoint Studio で、メインメニューから ​**\[File (ファイル)\] > \[New (新規)\] > \[Mule Project (Mule プロジェクト)\]**​ を選択します。
2. Mule プロジェクトの名前を入力して、​**\[Finish (完了)\]**​ をクリックします。
3. **\[Mule Palette (Mule パレット)\]**​ ビューで、​**\[(X) Search in Exchange ((X) Exchange 内を検索)\]**​ をクリックします。
4. **\[Add Modules to Project (モジュールをプロジェクトに追加)\]**​ で、検索項目に「​`powershell`​」と入力します。
5. **\[Available modules (使用可能なモジュール)\]**​ でコネクタの名前をクリックします。
6. **\[Add (追加)\]**​ をクリックします。
7. **\[Finish (完了)\]**​ をクリックします。

Studio でコネクタを Mule プロジェクトに追加しても、Studio ワークスペースの他のプロジェクトはそのコネクタを使用できません。

### [](#studio-でグローバル要素を設定する)Studio でグローバル要素を設定する

1. Studio で、キャンバスの一番下にある ​**\[Global Elements (グローバル要素)\]**​ タブをクリックします。
2. **\[Global Configuration Elements (グローバル設定要素)\]**​ 画面で、​**\[Create (作成)\]**​ をクリックします。
    
    ![「Global Configuration Elements (グローバル設定要素)」 ウィザード](/mulesoft/current/ja-jp/windows-powershell-connector/2/_images/microsoft-powershell-config-global-wizard.png)
3. **\[Choose Global Type (グローバル種別の選択)\]**​ ウィザードで、​**\[Connector Configuration (コネクタ設定)\]**​ を展開し、​**\[Windows Configuration (Windows 設定)\]**​ または ​**\[Linux Configuration (Linux 設定)\]**​ を選択して ​**\[OK\]**​ をクリックします。
    
    この選択により、選択したオペレーティングシステムの種別にリモート接続できます。
4. パラメーターを次のように設定します。
    
    <table class="tableblock frame-all grid-all stretch">
<colgroup>
<col style="width: 30%;">
<col style="width: 70%;">
</colgroup>
<thead>
<tr>
<th class="tableblock halign-left valign-top">パラメーター</th>
<th class="tableblock halign-left valign-top">説明</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong>Connection (接続)</strong></p></td>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p>Connection type (接続種別): Windows または Linux。</p>
</div></div></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong>IP アドレス</strong></p></td>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p>スクリプトファイルやコマンドを実行するマシンの IP アドレス。</p>
</div></div></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong>Username (ユーザー名)</strong></p></td>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p>Windows または Linux マシンに関連付けられているユーザー。</p>
</div></div></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong>Password (パスワード)</strong></p></td>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p>ユーザー名に関連付けられているパスワード。</p>
</div></div></td>
</tr>
</tbody>
</table>
    
    前の画像では、プレースホルダーの値は、プロジェクトの ​`src/main/resources`​ フォルダーにある設定ファイル ​`mule-artifact.properties`​ を参照します。  
    ログイン情報をグローバル設定プロパティに入力するか、それらの値を含む設定ファイルを参照することができます。
    
    プロジェクトのメンテナンスを簡略化して再利用性を向上させるには、設定ファイルを使用します。これらの値を別個のファイルに保存しておくと、アクセスログイン情報が異なるさまざまな環境 (本番、開発、QA など) にデプロイする必要がある場合に便利です。
    
    詳細は、​[「Anypoint Connector 設定」](https://docs.mulesoft.com/connectors/introduction/intro-connector-configuration-overview)​を参照してください。
5. **\[Advanced (詳細)\]**​ タブはデフォルト値のままにします。
6. **\[Test Connection (接続をテスト)\]**​ をクリックします。
7. **\[OK\]**​ をクリックします。
8. 設定は次のようになります。
    
    ![PowerShell のユースケースの設定](/mulesoft/current/ja-jp/windows-powershell-connector/2/_images/microsoft-powershell-config.png)

## [](#次のステップ)次のステップ

PowerShell Connector を設定したら、​[「例」](https://docs.mulesoft.com/jp/windows-powershell-connector/2/microsoft-powershell-connector-examples)​トピックで詳細な設定アイデアを参照してください。

## [](#関連情報)関連情報

- [Anypoint Connector の概要](https://docs.mulesoft.com/connectors/introduction/introduction-to-anypoint-connectors)
- [Anypoint Connector 設定](https://docs.mulesoft.com/connectors/introduction/intro-connector-configuration-overview)
- [Anypoint Studio を使用したコネクタの設定](https://docs.mulesoft.com/connectors/introduction/intro-config-use-studio)
- [Microsoft Windows PowerShell Connector](https://www.mulesoft.com/exchange/com.mulesoft.connectors/mule-powershell-connector/)
- [Windows 用 OpenSSH](https://github.com/PowerShell/Win32-OpenSSH/releases#)
- [OpenSSH インストール手順](https://github.com/PowerShell/Win32-OpenSSH/wiki/Install-Win32-OpenSSH)
- [Linux での SSH のインストール](https://help.ubuntu.com/lts/serverguide/openssh-server.html)
- [MuleSoft ヘルプセンター](https://help.mulesoft.com)