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)
}
The exact script can be found in Disable HotPlug
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Take a look at e.g. Re: Help with Script for Hot Add CPU/Mem for large number of VMs or http://ict-freak.nl/2009/07/08/powercli-add-multiple-values-to-a-vmx-file/ for sample scripts about modifying the configuration file.
André
The exact script can be found in Disable HotPlug
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference