Delete multiple site collections using SharePoint Power Shell Script




This script will delete site collections from the SharePoint server completely. But we need to provide the site collection names to the Power Shell Script as a ";" separated values.

Power Shell Script:

Ex: $SiteCollection = "http://SP-S2010/sites/TeamSite1;http://SP-S2010/sites/TeamSite2" 


$SiteCollection = "http://SP-S2010/sites/TeamSite1;http://SP-S2010/sites/TeamSite2" 
$SiteArray = $SiteCollection.Split(";")

foreach($Site in $SiteArray) 
{  
    Remove-SPSite –Identity $Site –GradualDelete –Confirm:$False
}

Comments

Popular posts from this blog

Sending email using Powershell script

Convert List Collection to DataTable using C#

Difference Between Site Template and Site Definition