我们如何为使用cmd安装IIS的Win2k12机器启用所有功能

时间:2014-01-16 00:16:02

标签: iis powershell cmd windows-server-2012 iis-8

对于Win2K8计算机,我们使用命令

安装IIS并启用所有功能
ServerManagerCmd.exe -install Web-Server -allSubFeatures -resultPath C:\Admin\WebServer.xml -restart

如何使用cmd为已安装IIS的Win2k12计算机启用所有功能?

2 个答案:

答案 0 :(得分:1)

我个人用这个:

Get-WindowsFeature | ? {$_.Name -match "^Web-"} | Install-WindowsFeature

  

不适用于Powershell 2.0

答案 1 :(得分:0)

安装了什么:

Get-WindowsFeature -Name Web* | where {$_.Installed -eq $True}

未安装的内容:

Get-WindowsFeature -Name Web* | where {$_.Installed -eq $False}

安装未安装的内容:

Get-WindowsFeature -Name Web* | where {$_.Installed -eq $False} | Install-WindowsFeature

我在最后一个上使用了-WhatIf Common Parameter,并收到有关需要安装源的警告。您可能需要研究Install-WindowsFeature cmdlet的-Source参数。