2014-12-02 58 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