SharePoint Delete Orphan Items

Deleting Orphan Features

Many of the times in deployment you many face issue of orphan features due to deployment fails, in that case features remains orphan and while redeployment it complains that feature is already installed.

In those cases you need to remove those orphan entries. you can use below command to get all orphan features

Get-SPFeature | ? { !$_.Scope }

And to delete all those orphan features you can use

Get-SPFeature | ? { !$_.Scope } | % { $_.Delete() }

Deleting Orphan Sites

Same way you might end up sometimes in orphan sites and that you can remove by using below command.

$site = Get-SPSite “your site collection name”;
$siteId = $site.Id;
$siteDatabase = $site.ContentDatabase;
$siteDatabase.ForceDeleteSite($siteId, $false, $false);

For more information on orphan sites you may refer http://social.technet.microsoft.com/wiki/contents/articles/21968.sharepoint-deleting-orphan-sites.aspx

Happy Reading! 🙂

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 )

Connecting to %s

%d bloggers like this: