This short post can help you get all the report you need for your IT Managers. Have you ever been asked how many databases you have for your SharePoint Farm? That is easy go get. Just open SharePoint 2010/2013 Management Shell and type Get-SPDatabase. This will list all the databases configured for your SharePoint farm. The powershell needs to run on any of the SharePoint Servers with farm admin account or any user with farm admin priviledge. The purpose of this post is not this.
This short post explains how to get all content databases, and for each of the content databases, it will show you the site collections within this content database, as it contains only 1 line of PowerShell code, and is not very hard to understand.
Here is your one line of Script
Get-SPContentDatabase | %{Write-Output “- $($_.Name)”; foreach($site in $_.sites){write-Output $site.url}}
And the following is the screenshot of the output of the script from my SharePoint 2013 test farm.
Hope this helps
Enjoy #Powershell
Tesfaye Gari tesfaye.gari@gmail.com OR @tesfayegari