2014-12-02 55 views
1

下面是我想在創建Windows Server 2012 R2(64位)後使用PowerShell安裝Web Server Windows Feature的AWS Cloudformation模板的一部分。但是,AWS Cloudformation成功創建Windows Server 2012 EC2實例,但不安裝Web Server角色。AWS:Cloudformation模板:安裝Windows功能問題

 "commands" : { 
      "1-install-roles" : { 
      "command" : { "Fn::Join" : [ "", [ 
      "if not \"None\" EQU \"", 
       { "Ref" : "Roles" }, 
       "\" (powershell -Command \"Install-WindowsFeature -Name Web-Server -IncludeAllSubFeature ", 
       { "Ref" : "Roles" }, 
       " -Restart\")"]] 
      } 
      }, 

感謝您的指導。

回答

1

我懷疑你是從一個cloudformation模板的例子中獲得的。我會建議嘗試,如果它與模板中的AMI(s)一起使用。如果沒有,您可以使用已經安裝了IIS的AMI。當我遇到同樣的問題時,這就是我正在做的工作。

更新:我研究和測試了更多。 PowerShell命令實際上應該是:

Add-WindowsFeature 

Install-WindowsFeature 

下面是我在PowerShell中運行,進入添加-WindowsFeature按預期工作的命令:

set-executionpolicy bypass 
ImportSystemModules 
Import-Module servermanager