Get ESXi host name for VDI client

The content below is taken from the original (Get ESXi host name for VDI client), to continue reading please visit the site. Remember to respect the Author & Copyright.

I'm trying to figure out if it is possible to retrieve the current ESXi host that a VDI client is sitting on from the Windows command line/powershell/some other tool. I have a situation with multiple ESXi hosts, and VDI clients are spun up/down randomly throughout the day. They could potentially be on any of the hosts at any given time, but I have some scripted operations that need to run based on the specific host that it is currently running on. Any way to pull the name/IP of the host locally from the VDI client?