

# EC2Rescue CLI로 손상된 Windows 인스턴스 문제 해결
<a name="ec2rw-cli"></a>

EC2Rescue for Windows Server 명령줄 인터페이스(CLI)를 사용해 프로그래밍 방식으로 EC2Rescue for Windows Server 플러그인("작업"이라고 부름)을 실행할 수 있습니다.

EC2Rescue for Windows Server 도구에는 두 가지 실행 모드가 있습니다.
+ **/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/ko_kr/AWSEC2/latest/UserGuide/ec2rw-cli.html)  | 애플리케이션, 시스템, EC2Config 이벤트 로그를 수집합니다. | 
| memory-dump |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/ko_kr/AWSEC2/latest/UserGuide/ec2rw-cli.html)  | 인스턴스에 있는 메모리 덤프 파일을 수집합니다. | 
| ec2config |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/ko_kr/AWSEC2/latest/UserGuide/ec2rw-cli.html)  | EC2Config 서비스에서 생성되는 로그 파일을 수집합니다. | 
| ec2launch |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/ko_kr/AWSEC2/latest/UserGuide/ec2rw-cli.html)  | EC2Launch 스크립트가 생성하는 로그 파일을 수집합니다. | 
| ssm-agent |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/ko_kr/AWSEC2/latest/UserGuide/ec2rw-cli.html)  | SSM Agent 및 패치 관리자 로그에 의해 생성된 로그 파일을 수집합니다. | 
| sysprep | 'Log Files' | Windows System Preparation 도구가 생성하는 로그 파일을 수집합니다. | 
| driver-setup |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/ko_kr/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/ko_kr/AWSEC2/latest/UserGuide/ec2rw-cli.html)  | SYSTEM 및 SOFTWARE Hive를 수집합니다. | 
| egpu |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/ko_kr/AWSEC2/latest/UserGuide/ec2rw-cli.html)  | 엘라스틱 GPU와 관련된 이벤트 로그를 수집합니다. | 
| boot-config | 'BCDEDIT Output' | HKEY\$1LOCAL\$1MACHINE\$1BCD00000000 Hive를 수집합니다. | 
| windows-update | 'Log Files' | Windows 업데이트에서 생성된 로그 파일을 수집합니다. Windows Server 2016 이상 버전의 경우 로그는 Windows용 이벤트 추적(ETW) 형식으로 수집됩니다. | 
| cloudendure |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/ko_kr/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 value로 지정합니다.

```
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/ko_kr/AWSEC2/latest/UserGuide/ec2rw-cli.html) | 
| firewall |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/ko_kr/AWSEC2/latest/UserGuide/ec2rw-cli.html)  |  Windows 방화벽 [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/ko_kr/AWSEC2/latest/UserGuide/ec2rw-cli.html)  | 
| rdp |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/ko_kr/AWSEC2/latest/UserGuide/ec2rw-cli.html)  |  원격 데스크톱 [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/ko_kr/AWSEC2/latest/UserGuide/ec2rw-cli.html)  | 
| ec2config |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/ko_kr/AWSEC2/latest/UserGuide/ec2rw-cli.html)  |  EC2Config [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/ko_kr/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/ko_kr/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 value를 사용하여 지정합니다.

볼륨에서 식별된 문제를 모두 해결하려고 시도합니다.

```
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 value를 사용하여 지정합니다.

볼륨에서 마지막으로 확인된 양호한 구성을 복원합니다.

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

볼륨에서 마지막 Windows 레지스트리 백업을 복원합니다.

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