Quantcast
Viewing all articles
Browse latest Browse all 46

Get a quick report of the SharePoint Databases with PowerShell [Tip]

Here comes another useful PowerShell one-liner I often use.
It will give you a quick overview of the SharePoint databases with properties like: Name, Server(Alias), TypeName, Web application name, Web application URL, Site collection count and the Size.
The size is actually the amount of disk space required for uncompressed backup. It might look something like a script, but actually it is a long and simple one-liner. You can see it below, I have used grave-accent(`) escape characters to fit it better in the blog. You can see it in one line here. Instead of piping to Format-Table you can generate CSV by piping to Export-CSV and later work with it in Excel.

Get-SPDatabase|Select-ObjectName,@{Expression={$_.Server};Label="Server"},TypeName,@{Expression=`
{
$_.WebApplication.Name};Label="WebAppLication"},@{Expression={$_.WebApplication.Url};Label="WebAppLicationUrl"}`
,@{Expression={($_.WebApplication.Sites|Measure).Count};Label="SC Count"},@{Label="Size in MB";`
Expression={$_.disksizerequired/1024/1024}} |Format-Table-AutoSize




Viewing all articles
Browse latest Browse all 46

Trending Articles