How to use this exceptional automation tool
| 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:
- Select Control Panel on the Start menu.
- In Control Panel, click Programs.
- Click Turn Windows features on or off.
- Expand Internet Information Services.
- Expand Web Management Tools.
- Select IIS Management Console.
- Click the OK button to initiate the installation.
To install the console on Server 2008 R2 or Server 2008, follow these steps:
- On the Start menu, select All Programs, choose Administrative Tools, and click Server Manager.
- In Server Manager, select Roles in the left pane to bring up the Role Summary View.
- Click the Add Roles link to open the Add Roles Wizard.
- On the Before You Begin page, click Next.
- On the Select Server Roles page, click the Web Server (IIS) check box.
- 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.
- An information dialog box will appear at this point. Click Next to proceed to the Select Role Services page.
- On the Select Role Services page, expand Internet Information Services.
- Under Web Management Tools, select IIS Management Console. Click Next.
- 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.

Figure 1: Starting the IIS PowerShell Management Console





