

# EC2Rescue CLI を使用して問題のある Windows インスタンスのトラブルシューティングを行う
<a name="ec2rw-cli"></a>

EC2Rescue for Windows Server コマンドラインインターフェース (CLI) を使用すると、EC2Rescue for Windows Server プラグイン (「アクション」と呼ばれます) をプログラムで実行できます。

EC2Rescue for Windows Server ツールには、次の 2 つの実行モードがあります。
+ [**/online**] — EC2Rescue for Windows Server がインストールされているインスタンス上で、ログファイルの収集などのアクションを実行できます。
+ **/offline:<device\$1id>** — EC2Rescue for Windows Server がインストールされている別個の Amazon EC2 Windows インスタンスにアタッチされているオフラインルートボリュームに対してアクションを実行できます。

[EC2Rescue for Windows Server](https://s3.amazonaws.com/ec2rescue/windows/EC2Rescue_latest.zip?x-download-source=docs) ツールを Windows インスタンスにダウンロードして、ファイルを展開します。次のコマンドを使用してヘルプファイルを表示できます。

```
EC2RescueCmd.exe /help
```

EC2Rescue for Windows Server は、Amazon EC2 Windows インスタンス上で次のアクションを実行できます。
+ [収集アクション](#ec2rw-collect)
+ [レスキューアクション](#ec2rw-rescue)
+ [復元アクション](#ec2rw-restore)

## 収集アクション
<a name="ec2rw-collect"></a>

**注記**  
すべてのログ、ロググループ全体、またはグループ内の個々のログを収集できます。

EC2Rescue for Windows Server は、**アクティブインスタンスおよびオフラインインスタンス**から、次のデータを収集できます。


| ロググループ | 使用可能なログ | 説明 | 
| --- | --- | --- | 
| all |  | 利用可能なすべてのログを収集します。 | 
| eventlog |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/ja_jp/AWSEC2/latest/UserGuide/ec2rw-cli.html)  | アプリケーション、システム、および EC2Config のイベントログを収集します。 | 
| memory-dump |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/ja_jp/AWSEC2/latest/UserGuide/ec2rw-cli.html)  | インスタンスに存在するメモリダンプファイルを収集します。 | 
| ec2config |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/ja_jp/AWSEC2/latest/UserGuide/ec2rw-cli.html)  | EC2Config サービスによって生成されたログファイルを収集します。 | 
| ec2launch |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/ja_jp/AWSEC2/latest/UserGuide/ec2rw-cli.html)  | EC2Launch スクリプトによって生成されたログファイルを収集します。 | 
| ssm-agent |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/ja_jp/AWSEC2/latest/UserGuide/ec2rw-cli.html)  | SSM エージェント、および Patch Manager ログによって生成されたログファイルを収集します。 | 
| sysprep | 'Log Files' | Windows システム準備ツールによって生成されたログファイルを収集します。 | 
| driver-setup |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/ja_jp/AWSEC2/latest/UserGuide/ec2rw-cli.html)  | Windows SetupAPI ログ (setupapi.dev.log および setupapi.setup.log) を収集します。 | 
| registry |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/ja_jp/AWSEC2/latest/UserGuide/ec2rw-cli.html)  | SYSTEM および SOFTWARE Hive を収集します。 | 
| egpu |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/ja_jp/AWSEC2/latest/UserGuide/ec2rw-cli.html)  | Elastic GPU に関連するイベントログを収集します。 | 
| boot-config | 'BCDEDIT Output' | HKEY\$1LOCAL\$1MACHINE\$1BCD00000000 を収集します。 | 
| windows-update | 'Log Files' | Windows Update によって生成されたログファイルを収集します。 Windows Server 2016 以降では、ログは Windows イベントトレーシング (ETW) 形式で収集されます。 | 
| cloudendure |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/ja_jp/AWSEC2/latest/UserGuide/ec2rw-cli.html)  | CloudEndure エージェントに関連するログファイルを収集します。 | 

EC2Rescue for Windows Serverは、**アクティブインスタンス**から次の追加データを収集できます。


| ロググループ | 使用可能なログ | 説明 | 
| --- | --- | --- | 
| system-info | 'MSInfo32 Output' | MSInfo32 を収集します。 | 
| gpresult | 'GPResult Output' |  グループポリシーレポートを収集します。  | 

以下のオプションが利用できます。
+ [**/output:<outputFilePath>**] - 収集したログファイルを zip 形式で保存するために必須の送信先ファイルパスの場所。
+ [**/no-offline**] - オフラインモードで使用する省略可能な属性。アクション完了後もボリュームをオフラインに設定しません。
+ [**/no-fix-signature**] - オフラインモードで使用する省略可能な属性。アクション完了後にディスク署名の競合が発生した場合でも修正しません。

### 例
<a name="ec2rw-collect-examples"></a>

以下に、EC2Rescue for Windows Server CLI の使用例を示します。

#### オンラインモードの例
<a name="ec2rw-collect-examples-online"></a>

利用可能なすべてのログを収集します。

```
EC2RescueCmd /accepteula /online /collect:all /output:<outputFilePath>
```

特定ロググループのみ収集します。

```
EC2RescueCmd /accepteula /online /collect:ec2config /output:<outputFilePath>
```

ロググループ内の個々のログを収集します。

```
EC2RescueCmd /accepteula /online /collect:'ec2config.Log Files,driver-setup.SetupAPI Log Files' /output:<outputFilePath>
```

#### オフラインモードの例
<a name="ec2rw-collect-examples-offline"></a>

EBS ボリュームから利用可能なすべてのログを収集します。ボリュームは、device\$1id 値を使用して指定します。

```
EC2RescueCmd /accepteula /offline:xvdf /collect:all /output:<outputFilePath>
```

特定ロググループのみ収集します。

```
EC2RescueCmd /accepteula /offline:xvdf /collect:ec2config /output:<outputFilePath>
```

## レスキューアクション
<a name="ec2rw-rescue"></a>

EC2Rescue for Windows Server は、次のサービス設定を使用して、問題を検出し、対応できます。


|  サービスグループ  | 使用可能なアクション |  説明  | 
| --- | --- | --- | 
| all |  |  | 
| system-time | 'RealTimeIsUniversal' | システム時刻[\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/ja_jp/AWSEC2/latest/UserGuide/ec2rw-cli.html) | 
| firewall |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/ja_jp/AWSEC2/latest/UserGuide/ec2rw-cli.html)  |  Windows ファイアウォール [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/ja_jp/AWSEC2/latest/UserGuide/ec2rw-cli.html)  | 
| rdp |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/ja_jp/AWSEC2/latest/UserGuide/ec2rw-cli.html)  |  リモートデスクトップ [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/ja_jp/AWSEC2/latest/UserGuide/ec2rw-cli.html)  | 
| ec2config |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/ja_jp/AWSEC2/latest/UserGuide/ec2rw-cli.html)  |  EC2Config [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/ja_jp/AWSEC2/latest/UserGuide/ec2rw-cli.html)  | 
| ec2launch | 'Reset Administrator Password' | 新しい Windows 管理者パスワードを生成します。 | 
| network | 'DHCP Service Startup' |  ネットワークインターフェイス [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/ja_jp/AWSEC2/latest/UserGuide/ec2rw-cli.html)  | 

以下のオプションが利用できます。
+ [**/level:<level>**] - アクションをトリガーする必要があるチェックレベルの省略可能な属性。許容値は、`information`、`warning`、`error`、`all` のいずれかです。デフォルトでは、`error` に設定されます。
+ [**/check-only**] - レポートは生成するが、オフラインボリュームに変更は加えない省略可能な属性。
**注記**  
EC2Rescue for Windows Server がディスク署名の衝突の可能性を検出すると、`/check-only` オプションを使用した場合でも、デフォルトではオフラインプロセスの完了後に署名を修正します。修正されないようにするには、`/no-fix-signature` オプションを使用する必要があります。
+ [**/no-offline**] - アクションの完了後にボリュームをオフラインに設定しないための省略可能な属性。
+ [**/no-fix-signature**] - アクションの完了後にディスク署名の競合が発生しても修正しないための省略可能な属性。

### レスキューの例
<a name="ec2rw-rescue-examples"></a>

以下に、EC2Rescue for Windows Server CLI の使用例を示します。ボリュームは、device\$1id 値を使用して指定します。

ボリューム上で特定されたすべての問題の修正を試みる。

```
EC2RescueCmd /accepteula /offline:xvdf /rescue:all
```

ボリューム上のサービスグループ内のすべての問題の修正を試みる。

```
EC2RescueCmd /accepteula /offline:xvdf /rescue:firewall
```

ボリューム上の特定のサービスグループ内の特定の項目の修正を試みる。

```
EC2RescueCmd /accepteula /offline:xvdf /rescue:rdp.'Service Start'
```

ボリューム上で修正を試みる複数の問題を指定する。

```
EC2RescueCmd /accepteula /offline:xvdf /rescue:'system-time.RealTimeIsUniversal,ec2config.Service Start'
```

## 復元アクション
<a name="ec2rw-restore"></a>

EC2Rescue for Windows Server は、次のサービス設定を使用して、問題を検出し、対応できます。


|  サービスグループ  | 使用可能なアクション |  説明  | 
| --- | --- | --- | 
|  最後の既知の正常な設定の復元  | lkgc | [最後に既知の良好な設定] - 最後に既知のブート可能状態でインスタンスの起動を試みます。 | 
| 最新のバックアップからの Windows レジストリの復元 | regback | [バックアップからレジストリを復元] - \$1Windows\$1System32\$1config\$1RegBack からレジストリを復元します。 | 

以下のオプションが利用できます。
+ [**/no-offline**] — アクションの完了後にボリュームをオフラインに設定しないための省略可能な属性。
+ [**/no-fix-signature**] — アクションの完了後にディスク署名の競合が発生しても修正しないための省略可能な属性。

### 復元の例
<a name="ec2rw-restore-examples"></a>

以下に、EC2Rescue for Windows Server CLI の使用例を示します。ボリュームは、device\$1id 値を使用して指定します。

ボリューム上の最後の既知の正常な設定を復元します。

```
EC2RescueCmd /accepteula /offline:xvdf /restore:lkgc
```

ボリューム上の最新の Windows レジストリバックアップを復元します。

```
EC2RescueCmd /accepteula /offline:xvdf /restore:regback
```