How to delete a SharePoint site that is being naughty


For some reason I was unable to delete a site in my SharePoint 2010 environment. This time, I wasn’t really interested in figuring out why, I just wanted the site to go away.

Side note: I admit that I didn’t like this site. Let’s call it “SharePoint_DevEnv_01-Oct-2011_000004″ for brevity sake. It had done nothing wrong to me, it hadn’t insulted my family, but it just rubbed me the wrong way and had to go. You know how sometimes an SPWeb just gives you the willys? Well this one did, and I’m glad it got the axe.

The site had no sub-sites, no custom features or code – it was basically an empty team site with one or two documents in it.

Attempting to delete it by going Site Settings > Delete this site failed, as did trying to remove it via the Sites and workspaces list.

What did work however was PowerShell (cue Superman theme). I’m not sure why PowerShell managed to delete the site when SharePoint’s front-end wouldn’t allow me to, but I was happy with the result nonetheless. This being a dev environment, I wasn’t really concerned if a larger issue was at play – the environment gets reinstalled every so often anyway.

To delete a site via PowerShell, simply go Remove-SPWeb “http://server/sitename”, then press Y to confirm.

About these ads

4 thoughts on “How to delete a SharePoint site that is being naughty

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s