PowerCLI: Scripted edit of a VMX file

From VI-Toolkit
Jump to navigation Jump to search

Scripted edit of a VMX file

author: Craig Baltzer


Craig shows here how you can adjust keys and values in a scripted manner for the hardware configuration of your virtual machine.


 $vm = Get-View (Get-VM +NameofVMtoUpdate+).ID
 $vmConfigSpec = New-Object VMware.Vim.VirtualMachineConfigSpec
 $vmConfigSpec.extraconfig += New-Object VMware.Vim.optionvalue


  • NameofVMtoUpdate is the name of the VM you want to update (from the vCenter inventory)
  • lefthandsideofentry is the advanced configuration entry you want to set
  • rigthhandsideofentry is the value for the advanced configuration entry


VMTN: Scripted edit of a VMX file