Wednesday, August 14, 2013

Need to remove advanced values from VMX file

Due to a previous VMware administrator electing to harden  VMX files of all VMs in an environment to prevent unwanted downtime from individuals installing VMware tools upgrades manually, I ran into an issue using VMware Update Manager to remediate VMware Tools.

I can understand, and partially agree with him that in prior versions it was a good idea to disable such but now with 5.1 with the fact we no longer have to reboot for VMware tools upgrades to occur my life has become much more complicated and we constantly run into issues with VMs having tools mounted and no way to force unmount tools.

I began looking for a PowerCLI script to removed these advanced values from the VMX file for all VMs attached to a vCenter. In my search i learned the following values were causing me all this pain:

isolation.tools.autoInstall.disable = true

isolation.tools.guestInitiatedUpgrade.disable = false

isolation.tools.connectable.disable=true

Thanks to PowerCLI and having some friends with expert knowledge, we were able to overcome this using the following script. Enjoy!

 



$vm = Get-VM -Name MyVM

$spec = New-Object VMware.Vim.VirtualMachineConfigSpec
$spec.tools = New-Object VMware.Vim.ToolsConfigInfo

$extra1 = New-Object VMware.Vim.OptionValue
$extra1.Key = "isolation.tools.autoInstall.disable"
$extra1.Value = "false"
$spec.ExtraConfig += $extra1
$extra2 = New-Object VMware.Vim.OptionValue
$extra2.Key = "isolation.tools.guestInitiatedUpgrade.disable"
$extra2.Value = "true"
$spec.ExtraConfig += $extra2
$extra3 = New-Object VMware.Vim.OptionValue
$extra3.Key = "isolation.tools.connectable.disable"
$extra3.Value = "flase"
$spec.ExtraConfig += $extra3

$vm.ExtensionData.ReconfigVM($spec)


No comments:

Post a Comment