Retrieve and Set VM Advanced Configuration (VMX) settings

Version 4

    The following vSphere SDK for Perl script allows you to retrieve all advanced configuration settings of a Virtual Machine or a specific key. The script also allows you create your own custom advanced configurations for a VM.

     

    Here is an example of listing all advanced configuration setting for a VM:

     

    $ ./vmAdvSettings.pl --server vcenter50-3 --username root --vmname MyVM --operation list

    Key: ethernet0.filter0.param0   Value: vshield-dvfilter-module
    Key: ethernet0.filter0.param1   Value: uuid=5019b662-a14c-8166-9ce3-61f362de05a3.000
    Key: evcCompatibilityMode       Value: FALSE
    Key: guestCPUID.0       Value: 0000000b756e65476c65746e49656e69
    Key: guestCPUID.1       Value: 000106a400010800809822010febfbff
    Key: guestCPUID.80000001        Value: 00000000000000000000000128100800
    Key: hostCPUID.0        Value: 0000000b756e65476c65746e49656e69
    Key: hostCPUID.1        Value: 000106a400010800809822210febfbff
    Key: hostCPUID.80000001 Value: 00000000000000000000000128100800
    Key: hpet0.present      Value: true
    Key: migrate.hostLogState       Value: none
    Key: migrate.migrationId        Value: 0
    Key: nvram      Value: MyVM.nvram
    Key: replay.supported   Value: false
    Key: scsi0.pciSlotNumber        Value: 16
    Key: snapshot.action    Value: keep
    Key: uuid.action        Value: create
    Key: virtualHW.productCompatibility     Value: hosted
    Key: vmci0.pciSlotNumber        Value: 32
    Key: vmotion.checkpointFBSize   Value: 4194304
    Key: vmware.tools.installstate  Value: none
    Key: vmware.tools.internalversion       Value: 2147483647
    Key: vmware.tools.lastInstallStatus     Value: unknown
    Key: vmware.tools.requiredversion       Value: 8384
    

     

    Here is an example of querying for a specific advanced configuration setting for a VM:

     

    $ ./vmAdvSettings.pl --server vcenter50-3 --username root --vmname MyVM --operation list --key ethernet0.filter0.param1

     

    Key: ethernet0.filter0.param1   Value: uuid=5019b662-a14c-8166-9ce3-61f362de05a3.000

     

    Here is an example of setting a custom advanced configuration for a VM:


    ./vmAdvSettings.pl --server vcenter50-3 --username root --vmname MyVM --operation update --key asset.tag --value ABC123

    Reconfiguring "MyVM" with advanced setting: "asset.tag = ABC123" ...
    Successfully updated advanced setting for "MyVM"!
    

     

    You can also perform a bulk update by specifying a list of key/value pairs in a file (seperate the key and value using a comma):

     

    Here is an example of a file:

    tools.guestlib.enableHostInfo,FALSE
    tools.setInfo.sizeLimit,1048576
    vmci0.unrestricted,FALSE

     

    Here is an example of setting bulk custom advanced configurations for a VM:

     

    ./vmAdvSettings.pl --server vcenter50-3 --username root --vmname MyVM --operation update --optionlist LIST-OF-KEY-VALUE

    Reconfiguring MyVM1 advanced setting(s) ...
    Successfully updated advanced setting for MyVM1