VMware Cloud Community
johnwilk
Contributor
Contributor
Jump to solution

Disable VMTools Upgrade

Hi,

I am working in a Linux shop and one of their top issues is that auto update of vmtools corrupts the fstab on many machines during power on. Is there an easy way to prevent the vms from auto updating on power on, effectively stopping vmtolls from doing this?

I am new to the VIToolkit so something reeeaaaally simple would be much appreciated. Smiley Happy

0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

Warning: what follows will make you even more enamored with PS Smiley Wink

You can use several filtering techniques around the Get-VM cmdlet.

Some examples:

1) only the VMs in a specific resource pool

Get-ResourcePool <Pool-name> | Get-VM | Get-View | %{
....

2) Only guests with a specific name.

All VMs whose name starts with "ABC"

Get-VM ABC*| Get-View | %{
....

3) Only guests with a specific OS

This selects all guests with an OS name (as discovered by VMware Tools) that starts with "Red Hat Enterprise Linux 3"

Get-VM | Get-View | where {$_.Guest.GuestFullName -match "Red Hat Enterprise Linux 3"} | %{
....

... and there are many more possibilities


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

View solution in original post

0 Kudos
9 Replies
LucD
Leadership
Leadership
Jump to solution

That is mentioned in the VITK FAQ.

In your case you would have to do it this way

$vm = Get-VM <VM-name> | Get-View
$vmConfigSpec = New-Object VMware.Vim.VirtualMachineConfigSpec
$vmConfigSpec.Tools = New-Object VMware.Vim.ToolsConfigInfo 
$vmConfigSpec.Tools.ToolsUpgradePolicy = "manual"
$vm.ReconfigVM($vmConfigSpec)


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

johnwilk
Contributor
Contributor
Jump to solution

LucD - Genius....Just tested against one vm. If I wanted to apply this to all vms do i just need to omit the &lt;VM-name&gt; option?

0 Kudos
LucD
Leadership
Leadership
Jump to solution

No not that way, but it's easy to make a loop through all the guests this way..

$vmConfigSpec = New-Object VMware.Vim.VirtualMachineConfigSpec
$vmConfigSpec.Tools = New-Object VMware.Vim.ToolsConfigInfo 
$vmConfigSpec.Tools.ToolsUpgradePolicy = "manual"

Get-VM | Get-View | % {
	$_.ReconfigVM($vmConfigSpec)
}

Don't you just love PowerShell Smiley Wink


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

johnwilk
Contributor
Contributor
Jump to solution

I do now!!

One last queston. Although i am bed-wettingly excited about applying this to 300 vms, I would be far more confident applying it at Resource Pool level. Any examples available? max points for this...

0 Kudos
LucD
Leadership
Leadership
Jump to solution

Warning: what follows will make you even more enamored with PS Smiley Wink

You can use several filtering techniques around the Get-VM cmdlet.

Some examples:

1) only the VMs in a specific resource pool

Get-ResourcePool <Pool-name> | Get-VM | Get-View | %{
....

2) Only guests with a specific name.

All VMs whose name starts with "ABC"

Get-VM ABC*| Get-View | %{
....

3) Only guests with a specific OS

This selects all guests with an OS name (as discovered by VMware Tools) that starts with "Red Hat Enterprise Linux 3"

Get-VM | Get-View | where {$_.Guest.GuestFullName -match "Red Hat Enterprise Linux 3"} | %{
....

... and there are many more possibilities


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

0 Kudos
johnwilk
Contributor
Contributor
Jump to solution

Thanks LucD

So for my Resource Pool would the code be:

Get-ResourcePool test-pool | Get-VM | Get-View | %{

$vmConfigSpec = New-Object VMware.Vim.VirtualMachineConfigSpec

$vmConfigSpec.Tools = New-Object VMware.Vim.ToolsConfigInfo

$vmConfigSpec.Tools.ToolsUpgradePolicy = "manual"

Get-VM | Get-View | % {$_.ReconfigVM($vmConfigSpec)

}

0 Kudos
LucD
Leadership
Leadership
Jump to solution

I suspect you access the forum with an IE browser.

That type seems to have a problem with the VMTN forum, I use FF.

This is what you should use for a resource pool

$vmConfigSpec = New-Object VMware.Vim.VirtualMachineConfigSpec
$vmConfigSpec.Tools = New-Object VMware.Vim.ToolsConfigInfo 
$vmConfigSpec.Tools.ToolsUpgradePolicy = "manual"

Get-ResourcePool test-pool | Get-VM | Get-View | % {
	$_.ReconfigVM($vmConfigSpec)
}

I attached the script to be on the safe side.


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

0 Kudos
johnwilk
Contributor
Contributor
Jump to solution

It's official.......PS and the VIToolkit are the best thing since sliced bread. I have just set VMTools to manual install across 237 Linux vms in under an hour. LucD.....you have justed saved me a weeks work. if we ever meet, I owe you several beers Smiley Wink

0 Kudos
ToddBertschi
Contributor
Contributor
Jump to solution

For anyone doing some searching and stumbling across this, if you're running vCenter 5.x this article shows how to disable or enable the VMTools for your environment using the Update Manager. I still prefer the CLI/PS way, but this is quicker for a lot of people.

http://pubs.vmware.com/vsphere-51/index.jsp?topic=%2Fcom.vmware.vsphere.update_manager.doc%2FGUID-6F...

Peace

--Todd

0 Kudos