Get all SharePoint database sizes

SharePoint creates 15+ databases during installation and configuration and it’s possible you want to know the size of each database without connecting to the database server or manually checking each size.

You can easily get the size of each database using the following PowerShell one-liner:

Get-SPDatabase | Sort-Object disksizerequired -desc | %{write-host  “Size: $($_.disksizerequired/1mb)MB – Database: $($_.Name)”}



Note that these numbers are the space used in the database.

For example:

  • WSS_UsageApplication has a database size of 6231,13MB and has 1819,30MB space available.
    The actual data is 4411MB
  • WSS_Content_Portal has a database size of 216,50MB and has 30,30MB space available.
    The actual data is 186,2MB

Get SharePoint 2010 Managed paths with PowerShell

You created an environment with a couple of web applications that each have their own unique managed paths. With this PowerShell code you can view which managed paths you have used for each web application. You dont have to click trough SharePoint 2010 anymore.

This oneliner gets all managed paths per web application:

get-spwebapplication | %{$url = $_.url; write-host “`nWeb app: $($_.url)”; get-spmanagedpath -webapplication $_ | %{write-host ”     Type: $($_.type) – url: $($url)$($”}}


It first gets all web applications and displays the url, then it will get all managed paths per web application and displays the type and url.


Get SharePoint 2010 SMTP Server with PowerShell

Because we monitor a lot of SharePoint servers we dont want to click through central admin if we want to know if anything has changed. The SMTP server is also something that we want to see with our summary script.

There are a couple of ways to get the SMTP Server name:

1. Using Central Administration

When navigating to ‘Central Administration –> System Settings –> Configure outgoing e-mail settings’



2. Using PowerShell

The following line of code can be filled in to get the configured SMTP Server using PowerShell

(get-spwebapplication)[0] | %{$_.outboundmailserviceinstance.server}



When we put this code with the below posts we already can view SharePoint 2010 edition, version and SMTP Server.



In the next couple of posts I will expand this script with managed paths, site collections, web applications, size, databases, service applications and solutions.