How To Manage WebSites using PowerShell on IIS 8


As PowerShell continues to evolve and more features are added with each OS release there is more places to use PowerShell to automate and make many tasks easy. In this post we will explore managing websites using PowerShell, so let’s get started. the examples used in this post are from Cognos modifications to the default IIS 8 install.

The Code

All of the commands we will be using are part of the WebAdministration PowerShell module. Open PowerShell and import the module.

PS C:\> Import-module WebAdministration

Now we are ready to go!

Create a Virtual Directory called c10 under Default Web Site.

Create a nested Virtual Directory under virtual directory c10.

Set ISAPI-CGI security Settings

Define an new isapicgiRestriction to allow unspecified CGI and ISAPI modules.

Add cgi module handler

Convert to application

Create Application Pool

Set HTTP Redirect


As we can see with PowerShell we can create websites, virtual directoyies, application pools and modify other settings.


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.