Friday, 20 September 2013

Using PowerShell to determine SharePoint database size

Open the Sharepoint management shell
Then
Run the following command
To get list of databases
Get-SPDatabase
The following command to get list of every database used and its Size
Get-SPDatabase | Sort-Object disksizerequired -desc | Format-Table Name, @{Label =”Size in MB”; Expression = {$_.disksizerequired/1024/1024}}

To know how much total space is needed
Run the following
Get-SPDatabase | ForEach-Object {$db=0} {$db +=$_.disksizerequired; $_.name + ” – ” + $_.disksizerequired/1024/1024} {Write-Host “`nTotal Storage (in MB) =” (“{0:n0}” -f ($db/1024/1024))}

No comments:

Post a Comment