Thursday, December 4, 2014

Deleting an orphaned or inaccessable SharePoint site

Sometimes when provisioning sites via PowerShell I’ll get a failure somewhere along the process and the site gets created but cannot be accessed or deleted via Central Admin. I believe this is because all of the provisioning steps did not complete. The following 2 lines of PowerShell will force deletion of the site.

PowerShell


# 1. Get the site object
$site = get-spsite "https://yourdomain/sites/sample";

# 2. Force the site deletion via the contentdatabase
$site.contentdatabase.forcedeletesite($site.id, $false, $false);

No comments:

Post a Comment