PowerShell Snap-in: Navigating the IIS Snap-in Namespace

by Thomas Deml

Everybody is familiar on how the file system is organized. File systems are hierarchical namespaces, comprised of directories that contain files and other directories. PowerShell Snap-in leverage this familarity with the file system and allow other data stores to be exposed as an hierarchical namespace. Like the root of a file system drive is usually C:\ the root of the IIS configuration system is "IIS:\".

Underneath the root "IIS:\" drive you will find "Sites" and Application Pools - "AppPools" in short.

Organization of the IIS Snap-in Namespace

Here is the structure of the IIS PowerShell Snap-in namespace. The following containers cannot be deleted or moved.

  • IIS:\

    • Sites

      • Site Collection

        • Applications and Virtual Directories
    • AppPools

      • WorkerProcesses
    • SslBindings

Note: if Worker Processes are started you will find PowerShell Process objects in the Worker Process collection. This Process collection is augmented with Request and AppDomain objects. This allows you to query IIS Worker Processes for currently executing requests and running Application Domains.

Now let's try it out.

Task 1 - Getting Familiar with the IIS Provider Namespace

1.1. Start the IIS PowerShell Management Console

Click on the Start Menu - select "All Programs" - "IIS 7.0 Extensions" - "IIS PowerShell Management Console". The prompt of the new PowerShell command window is set to "IIS:\" - the root of the IIS Provider namespace.

1.2. Navigate the Namespace

Type "dir" and notice that Sites and AppPools are the only two directories underneath the root.

PS IIS:\> dir

As the next step we want to change into the Sites directory. You can do that with the following commands:

PS IIS:\> cd Sites
PS IIS:\Sites> dir
Name             ID   State      Physical Path                  Bindings
----             --   -----      -------------                  --------
Default Web Site 1    Started    f:\inetpub\wwwroot             http *:80:

If you are adventurous you will notice that typing cd Si<tab> will give you command-line completion.

Now try this:

1.2 Some more Navigation

Now try the following:

PS IIS:\Sites> Get-Item 'Default Web Site' | Select-Object *

PSPath                     : IIsProviderSnapIn\WebAdministration::\\THDLAP\Sites\Default Web Site
PSParentPath               : IIsProviderSnapIn\WebAdministration::\\THDLAP\Sites
PSChildName                : Default Web Site
PSDrive                    : IIS
PSProvider                 : IIsProviderSnapIn\WebAdministration
PSIsContainer              : True
State                      : Started
name                       : Default Web Site
id                         : 1
serverAutoStart            : True
bindings                   : {binding, binding}
limits                     : Microsoft.Web.Administration.ConfigurationElement
logFile                    : Microsoft.Web.Administration.ConfigurationElement
traceFailedRequestsLogging : Microsoft.Web.Administration.ConfigurationElement
applicationDefaults        : Microsoft.Web.Administration.ConfigurationElement
virtualDirectoryDefaults   : Microsoft.Web.Administration.ConfigurationElement
applicationPool            : DefaultAppPool
enabledProtocols           : http
userName                   :
password                   :
physicalPath               : f:\inetpub\wwwroot
Attributes                 : {name, id, serverAutoStart, state}
ChildElements              : {bindings, limits, logFile, traceFailedRequestsLogging...}
ElementTagName             : site
IsLocallyStored            : True
Methods                    : {Start, Stop}
RawAttributes              : {name, id, serverAutoStart, state}
Schema                     : Microsoft.Web.Administration.ConfigurationElementSchema

The first time we are trying a PowerShell cmdlet instead of using good old DOS commands like CD or DIR. If you want to effectively work with the IIS PowerShell Snap-in it is a good idea to get familiar with these commands.

Get-Item for example, is a command that allows you to get details about the item at the specified location. In our case we get details for the 'Default Web Site' (if you want to save some typing try 'get-item D<tab>' and the command-line will be automatically completed by PowerShell). We pipe the output of Get-Item to the Select-Object cmdlet and it displays all configuration settings of the 'Default Web Site'.


This walkthrough gave you a quick introduction in how the IIS Snap-in namespace is organized. You also learned some basic command to find your way around in the IIS namespace.