Install IIS (or any feature) on Windows 8 with Powershell

IIS8 is available in the latest version of the MS client operating system. It is also available from the GUI as any other feature, open Programs And Features under Control Panel and click on Turn Windows features on or off on the left hand side. Select Internet Information Services and you are ready to go, but if you want to customize additional modules and features feel free, you don’t have to worry about the dependencies.

Install IIS on windows 8
Install IIS on windows 8

Powershell commands

To work with features in Powershell you can use commandlets from the DISM module. To retrieve command use Get-Command, which gives you all the available functions and commandlets. To filter on a specified module use pipe and filter on modulename, or use the -module parameter of get-command.

Get-Command | Where {$_.modulename -eq “dism”}

Get-Command -Module dism

Both commands print the available commands.

Powershell commandlets in DISM module
Powershell commandlets in DISM module

From the available commands use

  • Get-WindowsOptionalFeature to retrieve the available features, check which ones are enabled and disabled and to get their correct names for installation or uninstallation
  • Enable-WindowsOptionalFeature to install a specific feature and its parents and dependencies
  • Disable-WindowsOptionalFeature to uninstall or turn off a specific feature and its dependencies

List features

You already know which command to use to retrieve available and installed features : Get-WindowsOptionalFeature. According to the help section (use Get-Help Get-WindowsOptionalFeature -full) it works with Windows images, but can also retrieve information from the local computer using the -online parameter. For example to list all locally currently disabled – but potentially available – feature, use this command:

Get-WindowsOptionalFeature -Online | where {$_.state -eq “Disabled”} | ft -Property featurename

Retrieve available features
Retrieve available features

The result is important, because during installation the feature name should be specified in this format and not the GUI names.

Install features

You already know two important things for the installation, the command to use and the name to specify correctly (after you retrieved feature names). Just add one and one together and use IIS-WebServerRole to install basic IIS features, don’t forget to specify the online parameter:

Enable-WindowsOptionalFeature -Online -FeatureName IIS-WebServerRole

Install IIS-WebServerRole
Install IIS-WebServerRole

Use the same method to add more features, like Tracing, etc. To check the result use the well known Get-WindowsOptionalFeature -Online command. As we specified only the IIS-WebServerRole feature a couple of additional parts enabled.

Enabled features
Enabled features

Now the GUI reflects the changes as well.


3 thoughts on “Install IIS (or any feature) on Windows 8 with Powershell”

  1. This is awesome. Thanks for the tip. I was trying to use the ServerManager module (Get-WindowsFeatures), but it only runs on Server OS’s. Glad this method works for configuring client OS’s. Kinda crappy they buried it in a different module and change the cmdlet names, but at least it works.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s