Delete a Web application using PowerShell in SharePoint 2016

To delete SharePoint Web application using PowerShell, use this cmdlet: Remove-SPWebApplication

How to Delete a Web Application and All its zones?

#Web Application URL to delete
$WebAppURL="https://sharepoint.company.com"

#sharepoint 2013 powershell delete web application
Remove-SPWebApplication -identity $WebAppURL -Confirm

This deletes the entire Web application and its all zones:

Remove Web Application Along with All its Databases and IIS Web Site:

To remove the Web application along with its content databases and the IIS Web site, use the switches: -DeleteIISSite and -RemoveContentDatabases

#Web Application URL to delete
$WebAppURL="https://sharepoint.company.com" 

#Remove the web application and its databases & IIS Web Application
Remove-SPWebApplication -identity $WebAppURL -Confirm -DeleteIISSite -RemoveContentDatabases
delete sharepoint web application using powershell

Delete the Extended Web Application zone:

To Removes the Extended Web Application zone, say “Internet”, use:

#Web Application URL to delete
$WebAppURL="https://sharepoint.company.com" 

#sharepoint 2013 powershell delete web app
Get-SPWebApplication https://sitename | Remove-SPWebApplication -Zone "Internet" -Confirm
Make sure you logged in as a “Farm Administrator” with “Shell Access” rights to delete web applications using PowerShell

Salaudeen Rajack

Salaudeen Rajack - SharePoint Expert with Two decades of SharePoint Experience. Love to Share my knowledge and experience with the SharePoint community, through real-time articles!

2 thoughts on “Delete a Web application using PowerShell in SharePoint 2016

  • Hi, If i’m specifying the “Zone”, but still in the confirm message, the name of the zone is the default one, how can I aim to the correct one (Custom)…

    Reply
  • Great guide and easy to follow! Thank you so much!

    Reply

Leave a Reply

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