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))}


Advertisements

6 thoughts on “Using PowerShell to determine SharePoint database size

  1. May I know how to find the database size in SharePoint 2007 farm? Also how to determine if the databases listed are pointing to the hostname or alias? Please help….

    Like

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s