I am working on a script intended to be executed on ESXi servers that do NOT have a vCenter.
I am currently using ESXi 6.0 with a plan to migrate to ESXi 6.5.
Is there a command that I can use to ask the ESXi server if it is being managed by a vCenter?
The first thing the script in the Virtually Ghetto link is connect to vCenter which kind of defeats the purpose.
However, the following does work.
connect-VIServer $ipAddressOfESXi
$hostView = get-vmhost | get-view
if ($hostview.ManagementServerIP -eq $null) { write-host "No vCenter associated with server" }
Please check if this https://www.virtuallyghetto.com/2016/07/remotely-query-an-esxi-host-without-adding-it-to-vcenter-ser... is helpful. If not, you can remotely SSH into the host and grep for the parameter 'serverIp' in the file </etc/vmware/vpxa/vpxa.cfg>. This will be the IP of the vCenter that is managing this host.
Please consider marking this answer as "correct" or "helpful" if you think your questions have been answered.
Cheers,
Supreet
The first thing the script in the Virtually Ghetto link is connect to vCenter which kind of defeats the purpose.
However, the following does work.
connect-VIServer $ipAddressOfESXi
$hostView = get-vmhost | get-view
if ($hostview.ManagementServerIP -eq $null) { write-host "No vCenter associated with server" }