That was a challenge. So I have a script that “pings” vcentre host to make sure they are working okay.
Part of the script connects to the registry and checks ODBC to get the SQL server that is used.
So normally this works:
$VCServer = “VCServer”
$key = “SOFTWAREODBCODBC.INIVMware VirtualCenter”
$regKey = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey($type, $VCServer) $subregKey = $regKey.OpenSubKey($key)
$SQLServer = $subregkey.getValue(“Server”)
BUT, Mike is upgrading VCentre to the VSphere version and using a 64bit OS, but the machine that runs the script is 32bit. Here lies the problem, in that the new VCentre hides the ODBC information in a 64bit part of the registry that 32bit computers can’t access!
So after a lot of trial and error and using google I found this:
Its more code but works a dream and can get the 32bit registry keys too