Quick Clean-up for mysites

There are moments, when you need to remove all the mysites in a SharePoint environment

Quick PowerShell script

$sites = Get-SPSite | Where-Object {$_.Url -like “<host>/personal/*”}

foreach ($site in $sites)
{
$DisplaySite = $site.ToString()
write-host $DisplaySite.substring(11)
Remove-Spsite -identity $DisplaySite.substring(11) -confirm:$false
}

Advertisement

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 )

Facebook photo

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

Connecting to %s

%d bloggers like this: