VMware Cloud Community
billymonroe
Contributor
Contributor
Jump to solution

VMWare Tools "Set to Manual" Scirpt

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

0 Kudos
1 Solution

Accepted Solutions
RvdNieuwendijk
Leadership
Leadership
Jump to solution

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)

  }

}

Blog: https://rvdnieuwendijk.com/ | Twitter: @rvdnieuwendijk | Author of: https://www.packtpub.com/virtualization-and-cloud/learning-powercli-second-edition

View solution in original post

0 Kudos
4 Replies
RvdNieuwendijk
Leadership
Leadership
Jump to solution

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)

  }

}

Blog: https://rvdnieuwendijk.com/ | Twitter: @rvdnieuwendijk | Author of: https://www.packtpub.com/virtualization-and-cloud/learning-powercli-second-edition
0 Kudos
billymonroe
Contributor
Contributor
Jump to solution

Thanks a bunch!!! That worked!  I also appreciate your quick response.

0 Kudos
billymonroe
Contributor
Contributor
Jump to solution

Actually to change it back to enabled, do I just use "automatic" instead of manual?

0 Kudos
RvdNieuwendijk
Leadership
Leadership
Jump to solution

To change it back to enabled, you have to replace "manual" by "upgradeAtPowerCycle" on two places in the script.

Blog: https://rvdnieuwendijk.com/ | Twitter: @rvdnieuwendijk | Author of: https://www.packtpub.com/virtualization-and-cloud/learning-powercli-second-edition