How to get the VM's name as present in vCenter inventory within Guest OS
search cancel

How to get the VM's name as present in vCenter inventory within Guest OS

book

Article ID: 396357

calendar_today

Updated On:

Products

VMware vSphere ESXi

Issue/Introduction

This kb outlines the steps we can take to get the VM's name as present in vCenter inventory from the Guest OS. 

Resolution

> We need to set the VM's name as an advanced setting using guestinfo, then retrieve it from within the guest OS via VMware Tools.

> Advanced parameter to be added in VM from vSphere is "guestinfo.vmname". Follow below steps for same:
1. Power off the VM
2. Edit settings > VM Options > Advanced settings/Advanced Parameters Tab
3. To add a parameter, enter an attribute name and value for the parameter and click Add
Attribute name : guestinfo.vmname
Value : NameOfVM

4. Save changes and power on the VM

> Now from the Windows Guest OS we need to run below command to get the value :
"C:\Program Files\VMware\VMware Tools\vmtoolsd.exe" --cmd "info-get guestinfo.vmname"