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.
Warning: what follows will make you even more enamored with PS
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
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
LucD - Genius....Just tested against one vm. If I wanted to apply this to all vms do i just need to omit the <VM-name> option?
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
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
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...
Warning: what follows will make you even more enamored with PS
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
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)
}
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
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
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.
Peace
--Todd