Someone asked me how to retrieve list of all site collection residing in all content database of a database server. So have prepared a small script for this...
To Get the list of server execute below command
Get-SPServer
Above command will list all server in the farm.
Copy the SQL/Database server you intend to query...
$DBServerInstance = "XXXXXXXX"
Replace xxxx with the database server name/Alias if you are using alias.
$dbserver = Get-SPDatabase –ServerInstance $DBServerInstance
To Get the list of server execute below command
Get-SPServer
Above command will list all server in the farm.
Copy the SQL/Database server you intend to query...
$DBServerInstance = "XXXXXXXX"
Replace xxxx with the database server name/Alias if you are using alias.
$dbserver = Get-SPDatabase –ServerInstance $DBServerInstance
foreach ($db in $dbserver)
{
$db
Get-SPSite –ContentDatabase $db – Limit all | Select URL
}
You can redirect the output of foreach loop contents to a text file.