Automation

 View Only
  • 1.  PowerCLI & vmtools custom attributes

    Posted Aug 12, 2022 06:04 PM

    I'm using power cli to set a custom attribute on a virtual machine, and then I'd like to be able to retrieve the value of the custom attribute from the virtual machine itself using vmtools. Can anyone explain why it's returning no value when the custom attribute is visible via powerCLI and also in vSphere under the VM custom attributes?

     

     

     

     

     

    ctrought_0-1660327379059.png

      



  • 2.  RE: PowerCLI & vmtools custom attributes
    Best Answer

    Posted Aug 13, 2022 11:42 AM

    Hi.

    There was already a similar topic.

    https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/How-to-get-ESXi-Host-Name-within-running-VM/td-p/1872912

    It is possible though to set a custom attribute on the VM object in vCenter and then query this from within the the OS of the virtual machine.
    For example:

     

    Once this is set, it is possible to query it within the VM, using the VM tools and the following command:

     



  • 3.  RE: PowerCLI & vmtools custom attributes

    Posted Aug 15, 2022 09:09 PM

    Thanks a lot, that works perfectly!