Managing Internet Information Services with the IIS PowerShell Snap-In

How to use this exceptional automation tool

What is in this article?:

  • Managing Internet Information Services with the IIS PowerShell Snap-In
Downloads
144224.zip

Windows PowerShell has become a must-have tool for IT administrators. One of the latest and greatest PowerShell features is its ability to interact with and manage Microsoft IIS 7. The IIS PowerShell Snap-In lets you create, configure, and manage IIS 7 websites, web applications, application pools, virtual directories, and .NET application domains using PowerShell commands or scripts. The snap-in works with PowerShell 2.0 and earlier.

The IIS PowerShell Snap-In interacts with the IIS Management Console, so this console is a prerequisite to running the snap-in. I'll show you how to install the IIS Management Console and get the PowerShell Snap-In running on Windows 7, Windows Vista, Windows Server 2008 R2, and Windows Server 2008. Then, I'll show you how to use the snap-in to perform common IIS tasks.

Installing the IIS Management Console

To install the IIS Management Console, you need Administrator privileges for the computer on which you're installing it. To install the console on Windows 7 or Vista, follow these steps:

  1. Select Control Panel on the Start menu.
  2. In Control Panel, click Programs.
  3. Click Turn Windows features on or off.
  4. Expand Internet Information Services.
  5. Expand Web Management Tools.
  6. Select IIS Management Console.
  7. Click the OK button to initiate the installation.

To install the console on Server 2008 R2 or Server 2008, follow these steps:

  1. On the Start menu, select All Programs, choose Administrative Tools, and click Server Manager.
  2. In Server Manager, select Roles in the left pane to bring up the Role Summary View.
  3. Click the Add Roles link to open the Add Roles Wizard.
  4. On the Before You Begin page, click Next.
  5. On the Select Server Roles page, click the Web Server (IIS) check box.
  6. A dialog box will appear asking if you want to add the role services and features required for Web Server (IIS) support. Click Add Required Role Services to close the dialog box and return to the Select Server Roles page. Click Next.
  7. An information dialog box will appear at this point. Click Next to proceed to the Select Role Services page.
  8. On the Select Role Services page, expand Internet Information Services.
  9. Under Web Management Tools, select IIS Management Console. Click Next.
  10. If you're running Server 2008, click Install on the Confirm Installation Options page. You'll see an Installation Progress dialog box. After the installation has completed, click the Close button to return to Server Manager. If you're running Server 2008 R2, click Close right away, since the installation step is unnecessary.

When you install the IIS Management Console as just described, there's a noteworthy difference between Server 2008 and Server 2008 R2 and between Windows 7 and Vista. Server 2008 R2 and Windows 7 come with IIS 7.5, whereas Server 2008 and Windows Vista come with IIS 7.0. This distinction is important because IIS 7.5 includes the IIS PowerShell Snap-In, but IIS 7.0 doesn't include it. Therefore, to show you how to get the snap-in up and running, I've broken the discussion into two sections. Which one you should look at depends on your OS:

  • If you're using Server 2008 or Vista, read the "Getting the Snap-In Running on Server 2008 and Vista" section. You can skip the "Getting the Snap-In Running on Server 2008 R2 and Windows 7" section if you'd like.
  • If you're running Server 2008 R2 or Windows 7, read the "Getting the Snap-In Running on Server 2008 R2 and Windows 7" section. You can skip the "Getting the Snap-In Running on Server 2008 and Vista" section if you'd like.

Getting the Snap-In Running on Server 2008 and Vista

If you're running Server 2008 or Vista, you need to install and register the IIS PowerShell Snap-In because IIS 7.0 doesn't include it. You can download the snap-in from the Windows PowerShell Snap-In web page. Installing the snap-in is as easy as running a Windows Installer (.msi) file. The wizard takes care of the rest, including creating a shortcut for it on the Start menu.

Before you can use the IIS PowerShell Snap-In, you need to register it with PowerShell. You can automatically register the snap-in by selecting All Programs on the Start menu, choosing IIS 7.0 Extensions, and clicking the IIS PowerShell Management Console shortcut. You need Administrator privileges to manage IIS 7 configurations, so if you're logged on to Windows with an account that doesn't have Administrator privileges, you'll need to start the IIS PowerShell Management Console using the Run as administrator option, as Figure 1 shows.

Gravelle WIN2635 Fig 1
Figure 1: Starting the IIS PowerShell Management Console

 ยป

Please or Register to post comments.

IT/Dev Connections

Las Vegas
September 30th - October 4th

Paul ThurottYou'll have the opportunity to experience:
• The Microsoft
Technology Roadmap
• Office 365 Implementation
• Hyper-V Optimizing
• Windows 8 Deployment
and much more!

Come See Paul Thurrott & Rod Trent in Person!

Early Registration Now Open

Upcoming Training

Mastering System Center 2012

During over 6 hours of training you can join John Savill from your computer as he will walk you through the key components and capabilities of System Center 2012, what’s involved in using the components, and the benefit they can bring to your environment.

Register Now

Current Issue

May 2013 - The NameTranslate object is useful when you need to translate Active Directory object names between different formats, but it's awkward to use from PowerShell. Here's a PowerShell script that eliminates the awkwardness.

CURRENT ISSUE / ARCHIVE / SUBSCRIBE

Windows Forums

Get answers to questions, share tips, and engage with the Windows Community in our Forums.