Remove-WebApplication

Removes a web application from an IIS website.

Syntax

Remove-WebApplication
      [-Site <String>]
      [-Name] <String>
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]

Description

The Remove-WebApplication cmdlet removes a web application from an Internet Information Services (IIS) website.

Examples

Example 1: Add a web application and remove it

IIS:\> New-WebApplication -Name "TestApp" -Site "Default Web Site" -PhysicalPath "$Env:systemdrive\inetpub\TestApp" ; "Sleep for 5 seconds before Web App is removed" ; Sleep 5
IIS:\> Remove-WebApplication -Name "TestApp" -Site "Default Web Site"

This first command creates a web application named TestApp on the default website. The second command removes the application after 5 seconds.

Parameters

-Confirm

Prompts you for confirmation before running the cmdlet.

Type:SwitchParameter
Aliases:cf
Position:Named
Default value:False
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Name

Specifies the name of the application to remove from the site.

Type:String
Position:0
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-Site

Specifies the name of the site from which this cmdlet removes the application.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Type:SwitchParameter
Aliases:wi
Position:Named
Default value:False
Required:False
Accept pipeline input:False
Accept wildcard characters:False