- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Determine vCenter name from VM or ESX Host
Hi All,
Am trying to determine a way to fetch vCenter name for the VM / ESX host is registered to. Is there a vSphere CLI script I can use ?
This is needed because we receive an alert from monitoring agents saying so and so VM or so and so ESX server is down. Rather than hopping between multiple vCenters we should a have more simpler way to find vCenter name through some mechanism. Please advise.
thanks a ton in advance.
Shaheer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Welcome!
Discussion moved from VMware vCenter™ to VMware vSphere™ PowerCLI
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
welcome shaheer!!
this is what we've done in our environment to address the similer concern.
http://pingforinfo.com/powercli-sccript-for-exporting-vm-details-to-html/
we've autamated it with the help of windows task scheduler. Now we have the VM inverntory dailiy. So whenecer a VM failurre alert comes its just the mater of searching the inventory (HTML) file with the VM name.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The vCenter Server name is in the Uid property. You can use the string Split() method to extract the vCenter Server name:
Get-VM | Select-Object Name,@{N="vCenter";E={$_.Uid.Split('@')[1].Split(':')[0]}} Get-VMHost | Select-Object Name,@{N="vCenter";E={$_.Uid.Split('@')[1].Split(':')[0]}}