VMware Cloud Community
hum_mike
Contributor
Contributor
Jump to solution

Need Help updating the VMX file on several Virtual Machine's

All,

Can anyone help with an issue I am having?  Here a brief explaination of what is going on and what we need resolved.

Recently it has been discovered that we need to add a line into the the VMX file of several virtual machines.  In the past, I was able to do this, but would have to cold boot the VM for the changes to take affect.  The cold boot will not be an issue, as we can schedule this.

However, does anyone know a way to add this line into the VMX file of the virtual machines in a cluster.

Here's the line I need added:

devices.hotplug = "false"

Here is a script that was used a while back (esx 3.0 days) to keep VM tools updated at reboot.  At that time, if the VM was powered on, this change could not be made via the GUI.  However, this script worked to update the .vmx file, and then we scheduled cold reboots for the changes to take affect.

get-viserver -server <server> -user <user> -password <password>

$viview = Get-Cluster -name ClusterName | Get-VM | foreach-object { get-view ($_.ID)}
$viview | foreach-object {
$vmConfigSpec = New-Object VMware.Vim.VirtualMachineConfigSpec
$vmConfigSpec.Tools = New-Object VMware.Vim.ToolsConfigInfo
$vmConfigSpec.Tools.afterPowerOn = "True"
$vmConfigSpec.Tools.afterResume = "True"
$vmConfigSpec.Tools.beforeGuestStandby = "True"
$vmConfigSpec.Tools.beforeGuestShutdown = "True"
$vmConfigSpec.Tools.ToolsUpgradePolicy = "UpgradeAtPowerCycle"
$_.ReconfigVM($vmConfigSpec)
}

0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

The exact script can be found in Disable HotPlug


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

View solution in original post

0 Kudos
2 Replies
a_p_
Leadership
Leadership
Jump to solution

LucD
Leadership
Leadership
Jump to solution

The exact script can be found in Disable HotPlug


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos