How to know Site Collection associated with which Content Database

Its like very simple and sweet post - How to know which site collection associated with which content database.

Power Shell Command:-

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

Result look like this:-


We can easily convert the result into Text file using below command:-

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


Result look like this:-


Happy Coding !!

No comments:

Post a Comment