Remove a Web Application

Scenario/Problem: You need to remove a web application from the current server configuration.

Solution: Use the Remove-SPWebApplication cmdlet with a web application variable.

The Remove-SPWebApplication cmdlet enables you to remove a specific web application from the current server. Use this in conjunction with the Get-SPWebApplication cmdlet (explained in a previous section), as shown in Listing 5.3, or just use the web application identity directly in line, as shown in Listing 5.4.

Listing 5.3. Removing a Web Application Using a Variable Example

$webApp = Get-SPWebApplication -Identity "PSWebApp"Remove-SPWebApplication $webApp

Listing 5.4. Removing a Web Application Directly

Remove-SPWebApplication -Identity ...

Get PowerShell™ for SharePoint® 2013 How-To now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.