Script to find all site collections within database

In SharePoint 2013 by rhodzyLeave a Comment

A handy little script to find all site collections in a certain content database which emails the results via PowerShell. Change the items in bold

Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
$X = Get-SPSite -Limit All -ContentDatabase CONTENTDATABASENAME | select url, @{label=”Size”;Expression={$}} | out-string
Send-MailMessage -SmtpServer SMTPSERVERNAME -Subject “YOUREMAILSUBJECT” -Body $X -To -From