【问题标题】:AWS: Cloudformation template: Install Windows Feature questionsAWS:Cloudformation 模板:安装 Windows 功能问题
【发布时间】:2015-04-16 02:31:36
【问题描述】:

下面是 AWS Cloudformation 模板的 sn-p,我想在创建 Windows Server 2012 R2(64 位)后使用 PowerShell 安装 Web Server Windows 功能。但是,AWS Cloudformation 成功创建了 Windows Server 2012 EC2 实例,但没有安装 Web 服务器角色。

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

感谢您的指导。

【问题讨论】:

    标签: amazon-cloudformation


    【解决方案1】:

    我怀疑您是从 cloudformation 模板示例中获得的。我建议尝试它是否适用于模板中的 AMI。如果没有,您可以使用已经安装了 IIS 的 AMI。当我遇到同样的问题时,这就是我正在做的工作。

    更新:我进行了更多研究和测试。 powershell 命令实际上应该是:

    Add-WindowsFeature 
    

    不是

    Install-WindowsFeature
    

    以下是我在 PowerShell 中运行的命令,以使 Add-WindowsFeature 按预期工作:

    set-executionpolicy bypass
    ImportSystemModules
    Import-Module servermanager
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-11-27
      • 2020-04-25
      • 1970-01-01
      • 2020-06-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多