0

cloudsing 스크립트를 통해 windows ec2 서버를 설정해야합니다. 레이블을 추가하고 디스크 드라이브를 특정 형식으로 포맷하는 powershell 스크립트가 있습니다.Powershell 스크립트는 서버에서 작동하지만 cloudformation으로는 작동하지 않습니다. cfn-init 함수

문제는이 파워 쉘 스크립트가 cloudformation의 CFN 기능에서 전화를받을 때

a-label-format-drives-sql output: At C:\cfn\scripts\Label-and-Format-drives.ps1:44 char:35 
+  $ErrorActionPreference = "Stop" 
+         ~ 
The string is missing the terminator: ". 
At C:\cfn\scripts\Label-and-Format-drives.ps1:36 char:5 
+  { 
+  ~ 
Missing closing '}' in statement block. 
At C:\cfn\scripts\Label-and-Format-drives.ps1:27 char:19 
+ $LablenFormatPs={ 
+     ~ 
Missing closing '}' in statement block. 
At C:\cfn\scripts\Label-and-Format-drives.ps1:19 char:5 
+ try { 
+  ~ 
Missing closing '}' in statement block. 
At C:\cfn\scripts\Label-and-Format-drives.ps1:64 char:1 
+ 
The Try statement is missing its Catch or Finally block. 
    + CategoryInfo   : ParserError: (:) [], ParseException 
    + FullyQualifiedErrorId : TerminatorExpectedAtEndOfString 

(로그에서) 그러나 동일한 스크립트를 직접 같은 창에서 PowerShell 콘솔에서 실행 될 때 완벽하게 실행 EC2와 같은 오류를 제공하다 벌금. 나는이 poweshell 스크립트를 s3 bucket에 업로드했고, 그것을 cloudflow에서 가져 와서 ec2 인스턴스에 저장했다.

여기 내 전체 스크립트입니다. https://gist.github.com/rturam/c969e161b4089ac62d89b8ba5d1d1612

+0

로그는 무엇을 표시합니까? –

+0

의 붙여 넣기. – ExploringApple

답변

0

이 문제는 직접 해결할 수 있습니다. 웹 사이트에서 편집기로 복사하여 붙여 넣기 할 때 문제가 발생했습니다. 거기에 붙여 넣는 동안 이상한 인물들이 나타나 편집기에서 볼 수 없었습니다. 트릭은 PowerShell CLI에서 cat <file_name>을 수행하는 것입니다. 외장 문자가 있으면 표시합니다.