How to get all the Site Collections in a Content Database (PowerShell)

I found a really simple one liner PowerShell that will tell you which site collections are in which content databases.

Just copy this line (verbatim – no changes necessary) to a SharePoint 2010 Management Shell, and voila!

Get-SPContentDatabase | %{Write-Output "- $($_.Name)”; foreach($site in $_.sites){write-Output $site.url}}

The reference article is below.

http://sharepointrelated.com/2012/03/09/get-site-collections-per-content-database-one-liner/