Output Site Collection and storage information

Reporting on Site Collection and storage information

Wouldn’t it be nice to have a single report of Site Collections, the Content Database each is in, and the size in GB? Well, let’s do it!

First let’s grab the Web Application:

get-spwebapplication http ://SharePoint 
Then we grab the Site Collections (all of them):
Get-SPSite -Limit all 

Now, let’s select the information we want to see in the report:

select url,contentdatabase

Let’s calculate the size in Gigabytes:

select url,contentdatabase,@{label="Size in GB";Expression={$_.usage.storage/1GB}} 

Now, let’s output the report to a CSV file, making it easy to read in Excel:

convertto-csv | set-content "L:PowerShellDBsize.csv"

Now let’s put it all together in a single command, piping the commands to produce the report:

get-spwebapplication http ://SharePoint | Get-SPSite -Limit all | select url,contentdatabase,@{label="Size in GB";Expression={$_.usage.storage/1GB}} | convertto-csv | set-content "L:PowerShellDBsize.csv"
0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *