I personally use this:
Get-WindowsFeature | ? {$_.Name -match "^Web-"} | Install-WindowsFeature
Doesn't work on Powershell 2.0
Frage
For a Win2K8 machine we install IIS and enable all features using the command
ServerManagerCmd.exe -install Web-Server -allSubFeatures -resultPath C:\Admin\WebServer.xml -restart
How do we enable all features for Win2k12 machine where IIS is already installed using cmd ?
Lösung
I personally use this:
Get-WindowsFeature | ? {$_.Name -match "^Web-"} | Install-WindowsFeature
Doesn't work on Powershell 2.0
Andere Tipps
What is installed:
Get-WindowsFeature -Name Web* | where {$_.Installed -eq $True}
What is not installed:
Get-WindowsFeature -Name Web* | where {$_.Installed -eq $False}
Install what's not installed:
Get-WindowsFeature -Name Web* | where {$_.Installed -eq $False} | Install-WindowsFeature
I used the -WhatIf Common Parameter on the last one and got a warning about needing an install source. You may need to research the -Source parameter of Install-WindowsFeature cmdlet.