Good Morning,
I'm having some trouble building a Power CLI script to set all VM's in each "Datacenter" to manual. I do not want the option checked where it checks for updated tools and powercycle option. If anyone has a script out there "That Works", I would be extremely appreciative.
Thanks,
billy
Hi Billy,
the following PowerCLI script will set the option "Check and upgrade Tools during power cycling" to manual for all of your virtual machines.
$spec = New-Object VMware.Vim.VirtualMachineConfigSpec
$spec.tools = New-Object VMware.Vim.ToolsConfigInfo
$spec.tools.toolsUpgradePolicy = "manual"
Get-View -ViewType VirtualMachine -Filter @{"Config.Template"="False";"Config.Tools.ToolsUpgradePolicy"="^((?!manual).*)$"} | `
ForEach-Object {
if ($_) {
$_.ReconfigVM_Task($spec)
}
}
Hi Billy,
the following PowerCLI script will set the option "Check and upgrade Tools during power cycling" to manual for all of your virtual machines.
$spec = New-Object VMware.Vim.VirtualMachineConfigSpec
$spec.tools = New-Object VMware.Vim.ToolsConfigInfo
$spec.tools.toolsUpgradePolicy = "manual"
Get-View -ViewType VirtualMachine -Filter @{"Config.Template"="False";"Config.Tools.ToolsUpgradePolicy"="^((?!manual).*)$"} | `
ForEach-Object {
if ($_) {
$_.ReconfigVM_Task($spec)
}
}
Thanks a bunch!!! That worked! I also appreciate your quick response.
Actually to change it back to enabled, do I just use "automatic" instead of manual?
To change it back to enabled, you have to replace "manual" by "upgradeAtPowerCycle" on two places in the script.