I have X number of database servers on the farm , I need to know

Which database server have the SharePoint Configuration Database using Power-Shell ?

I know I can get Which server via Central Administration by Navigating to

System Settings > Servers on Farm

But I need to get SharePoint Configuration Database server via Power Shell ,

Is there a cmdlet to achieve that ?

Thanks !

3 Answers 3


Assuming a setup close to the defaults (and that you already loaded the SharePoint snapin via asnp *sh*), I would try this:

$server = (Get-SPDatabase | ?{$_.name -like "SharePoint_Config"})[0].Server

Select database by type, and ask for the server. Like this:

$ConfigDB = Get-SPDatabase | Where-Object{$_.Type -eq "Configuration Database"}
$a = Get-SPDatabase | Where-Object {$_.TypeName -like '*config*'}
Write-Host $a.Server

Works on: Sharepoint 2019 + Windows 2019

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.