Get Content Database Attached to WebApplications

 Recently, I was asked to generate a report which contains the name of content database of all respected web application in a SharePoint Server. 
 
Below Poweshell script helps us to get Content Database attached to WebApplications.
 
  1. Get-SPWebApplication | %{Write-Output "`n- $($_.url)"; foreach($cd in $_.contentdatabases){Write-Output $cd.name}}