Before we install IIS, we need to determine whether it is already installed. This is done differently in a client OS, such as Windows 8.1, rather than in a server OS such as Server 2012R2.
In a client OS, the cmdlet to use is Get-WindowsOptionalFeature
, and the name of the feature to look for is IIS-WebServerRole
. The –Online
switch tells the cmdlet to examine the OS running on the computer rather than looking in a Windows image. In the following screenshot, you can see that IIS is not enabled on my Windows 8.1 computer:
To install IIS, you can use the Enable-WindowsOptionalFeature
cmdlet using the IIS-WebServerRole
feature name again and the –Online
switch. I also added the –All
switch to tell Enable-WindowsOptionalFeature
to enable any required features as well: