Book Image

Getting Started with Powershell

Book Image

Getting Started with Powershell

Overview of this book

Table of Contents (19 chapters)
Getting Started with PowerShell
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Next Steps
Index

Installing IIS


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.

Detecting and installing IIS in Windows 8.1

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:

Detecting and installing IIS in Server 2012R2

The process to detect and install IIS in Server 2012R2 is similar to what we did in Windows 8.1, but it uses slightly different...