Get-IISServerManager

Gets the IISAdministration view of IIS ServerManager.

Syntax

Get-IISServerManager []

Description

The Get-IISServerManager cmdlet gets Internet Information Services (IIS) server manager object from Microsoft.Web.Administration.

Examples

Example 1: Get an active Microsoft.Web.Administration.ServerManager object

PS C:\> $SM = Get-IISServerManager

This command gets the active Microsoft.Web.Administration.ServerManager object and stores the result into the variable $SM.

Example 2: Use the ServerManager object to get site objects and list IIS Web sites

PS C:\> $SM = Get-IISServerManager
PS C:\> $Sites = $SM.Sites
PS C:\> $Sites
Name             ID   State      Physical Path                  Bindings
----             --   -----      -------------                  --------
Default Web Site 1    Stopped    %SystemDrive%\inetpub\wwwroot  http *:80: 
Patti            2    Started    C:\inetpub\Patti               http *:8080: 
                                                                http *:8033: 

FTPSite          3               C:\inetpub\ftproot             ftp *:21: 
DavidChe         4    Started    c:\                            http *:8088: 
MyNewSite        6555 Started    C:\inetpub\wwwroot             http *:8099: 
                                                                http *:8022: 
TestSite         5    Stopped    C:\inetpub\testsite            http *:8080:

This command gets site objects and lists all IIS web sites by using the ServerManager object.

Example 3: Use the ServerManager object to get application pool objects and recycle an application pool.

PS C:\> $SM = Get-IISServerManager
PS C:\> $SM.ApplicationPools["PattiFul"].Recycle()

This command uses the ServerManager object to get application pool objects and then recycles an application pool.

Inputs

None

Outputs

Object