VMtool update at power cycle and Manual

 Script to enable update vmtool at power cycle  and Manual

Using below script you can enable and disable VMtool update. You can schedule VMtool update using VUM as well.


#Script to update Vmtool on power cycle

Connect-VIServer -Server VCSA7.ads.com

$VM = Get-Content "c:\temp\VM_list.txt"

foreach ($i in $VM){

$vm = Get-VM -Name $i | % {Get-View $_.ID}

$vmConfigSpec = New-Object VMware.Vim.VirtualMachineConfigSpec

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

$vmConfigSpec.Tools.ToolsUpgradePolicy = "upgradeAtPowerCycle”

$vm.ReconfigVM($vmConfigSpec)


VM_List  -> Put list of the VMs on which you want to update VMTool

=======================================


Script to Disable update vmtool at power cycle 

#Script to change the VM update at power cycle to Manual


Connect-VIServer -Server VCSA7.ads.com

$VM = Get-Content "c:\temp\VM_list.txt"

foreach ($i in $VM){

$vm = Get-VM -Name $i | % {Get-View $_.ID}

$vmConfigSpec = New-Object VMware.Vim.VirtualMachineConfigSpec

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

$vmConfigSpec.Tools.ToolsUpgradePolicy = "Manual”

$vm.ReconfigVM($vmConfigSpec)



1 comment:

Featured Post

HPE MSA 2040 configuration step by step

HPE MSA 2040 configuration Default IP range for HP SAN storage MSA 2040 is 10.0.0.1/2 You need to connect your laptop and storage with...