Latest Posts



Translate

Total Pageviews

Friday, 15 March 2013

Find the name of the DB Server for vCenter

Today somebody asked me how to Find out the name of DB Server for vCenter Server. So Here is the Command that you can run in PowerCLI.

$vcName = $defaultVIServer.Name
$reg = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('LocalMachine', $vcName)
$vcKeys = $reg.OpenSubKey("SOFTWARE\\VMware, Inc.\\VMware VirtualCenter\\DB")
$dsnName = $vcKeys.GetValue("1")
$odbcKeys = $reg.OpenSubKey("SOFTWARE\\ODBC\\ODBC.INI\\" + $dsnName)
$dbServer = $odbcKeys.GetValue("Server")

Write-Host "vCenter server:" $vcName 
Write-Host "vCenter DB server:" $dbServer