Get Site Collection URL Content DataBase name and Size with PowerShell

Add-PSSnapin microsoft.sharepoint.powershell
$SizeLog = "D:\temp\SPSiteSize.csv"
############################################################
$CurrentDate = Get-Date -format d
$WebApps = Get-SPWebApplication
foreach($WebApp in $WebApps)
{
 $Sites = Get-SPSite -WebApplication $WebApp -Limit All
 foreach($Site in $Sites)
{
 $SizeInKB = $Site.Usage.Storage
 $SizeInGB = $SizeInKB/1024/1024/1024
 $SizeInGB = [math]::Round($SizeInGB,2)
 $CSVOutput = $Site.RootWeb.Title + "*" + $Site.URL + "*" + $Site.ContentDatabase.Name + "*" + $SizeInGB + "*" + $CurrentDate
 $CSVOutput | Out-File $SizeLog -Append
}
}
$Site.Dispose()

Comments

Popular posts from this blog

Clearing the Configuration Cache for SharePoint

SharePoint 2013 REST API CRUD Operations

Add List Item Attachments to Task Form using Nintex Workflow and Forms