Cannot remove SharePoint subsite using Remove-SPWeb


Recently I ran into a problem with a subsite that errored out on creation, but still was partially created. I needed to go into PowerShell to remove it. But Remove-SPWeb was not working.

I needed to do Get-SPWeb [URL of site]

The reason behind it is, the scope of the Get-SPSite is for site collections only. To get the object of Subsites you need to get the object of the Entire Web(Web Application) where the subsite is present. To achieve this we use the Get-SPWeb command.

So, to remove a subsite you first have to use Get-SPWeb, and then use Remove-SPWeb.

Share on Google Plus

About Tom DeMeulenaere

Highly accomplished information technology professional with extensive knowledge in System Center Configuration Manager, Windows Server, SharePoint, and Office 365.
    Blogger Comment

0 comments:

Post a Comment

Note: Only a member of this blog may post a comment.