Date and Month display

Remove Orphan site collection from content database using Powershell

#--------------------------------------------------------------------------------------------------------------------------------------------
# Author: Shiv Mangal Singh
# Date: May 17, 2016
# Description:
#  1. This script is used to remove Orphan site collection from content database.
# Syntax:
#
# e.g: .\ByPass_ListThrottling.ps1
#--------------------------------------------------------------------------------------------------------------------------------------------
# Add SharePoint cmdlets reference
Add-PSSnapin microsoft.sharepoint.powershell -ErrorAction SilentlyContinue

# Get Site collection
$site = Get-MSSite “http://MS.contoso.com/”
# Get site ID
$siteId = $site.Id    # Get associated content database name with Site.    
$siteDatabase = $site.ContentDatabase
                                       
Write-host $siteDatabase                                                                      
$siteDatabase.ForceDeleteSite($siteId, $false, $false)              

No comments:

Post a Comment