{"id":755,"date":"2011-11-18T15:04:51","date_gmt":"2011-11-18T20:04:51","guid":{"rendered":"http:\/\/enterpriseadmins.org\/blog\/?p=755"},"modified":"2011-12-06T08:45:23","modified_gmt":"2011-12-06T13:45:23","slug":"tools-upgrade-policy","status":"publish","type":"post","link":"https:\/\/enterpriseadmins.org\/blog\/scripting\/tools-upgrade-policy\/","title":{"rendered":"Tools Upgrade Policy"},"content":{"rendered":"<p>I was looking for a way to enable &#8220;Check and upgrade Tools during power cycling&#8221; for more than one VM at a time, but without enabling for all VM&#8217;s in the cluster.<br \/>\nIn this case our naming convention allowed for the quick and simple use of wildcards to make selections.<\/p>\n<p>From our test lab, I wanted to target only VM&#8217;s with &#8220;cel&#8221; in the name.<\/p>\n<p>First, verify the targeted VM&#8217;s are all set to manual.<\/p>\n<pre>\r\n#check policy status\r\nGet-VM *cel* | sort name | Select Name,@{N=\"UpgradePolicy\";E={$_.Extensiondata.Config.Tools.toolsUpgradePolicy}}\r\n\r\nName                                    UpgradePolicy\r\n----                                    -------------\r\nNAVCEL01                             \tmanual\r\nWEBCEL01                             \tmanual\r\nWEBCEL02                             \tmanual\r\nDEVCEL01                             \tmanual\r\nDEVCEL02                             \tmanual\r\nDEVCEL03                             \tmanual\r\n<\/pre>\n<p>Next, update the policy (effectively checking the box)<\/p>\n<pre><code class=\"language-powershell\">\r\n#change the UpgradePolicy to upgradeAtPowerCycle \r\n$vmConfigSpec = New-Object VMware.Vim.VirtualMachineConfigSpec\r\n$vmConfigSpec.Tools = New-Object VMware.Vim.ToolsConfigInfo\r\n$vmConfigSpec.Tools.ToolsUpgradePolicy = \"UpgradeAtPowerCycle\"\r\n\r\nGet-VM *cel* | %{\r\n     $_.Extensiondata.ReconfigVM($vmConfigSpec)\r\n}\r\n<\/code><\/pre>\n<p>Now to verify the targeted VM&#8217;s are all set to upgradeAtPowerCycle<\/p>\n<pre>\r\n#check policy status\r\nGet-VM *cel* | sort name | Select Name,@{N=\"UpgradePolicy\";E={$_.Extensiondata.Config.Tools.toolsUpgradePolicy}}\r\n\r\n\r\nName                                    UpgradePolicy\r\n----                                    -------------\r\nNAVCEL01                             \tupgradeAtPowerCycle\r\nWEBCEL01                             \tupgradeAtPowerCycle\r\nWEBCEL02                             \tupgradeAtPowerCycle\r\nDEVCEL01                             \tupgradeAtPowerCycle\r\nDEVCEL02                             \tupgradeAtPowerCycle\r\nDEVCEL03                             \tupgradeAtPowerCycle\r\n<\/pre>\n<p>In the link below, you&#8217;ll find code to update all VM&#8217;s in a cluster.<\/p>\n<p>Sources\/Credits: Community member LucD at <a href=\"http:\/\/communities.vmware.com\/message\/1601811\">communities.vmware.com\/message\/1601811<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I was looking for a way to enable &#8220;Check and upgrade Tools during power cycling&#8221; for more than one VM at a time, but without enabling for all VM&#8217;s in the cluster. In this case our naming convention allowed for &hellip; <a href=\"https:\/\/enterpriseadmins.org\/blog\/scripting\/tools-upgrade-policy\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[3,4],"tags":[],"class_list":["post-755","post","type-post","status-publish","format-standard","hentry","category-scripting","category-virtualization"],"_links":{"self":[{"href":"https:\/\/enterpriseadmins.org\/blog\/wp-json\/wp\/v2\/posts\/755","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/enterpriseadmins.org\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/enterpriseadmins.org\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/enterpriseadmins.org\/blog\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/enterpriseadmins.org\/blog\/wp-json\/wp\/v2\/comments?post=755"}],"version-history":[{"count":34,"href":"https:\/\/enterpriseadmins.org\/blog\/wp-json\/wp\/v2\/posts\/755\/revisions"}],"predecessor-version":[{"id":852,"href":"https:\/\/enterpriseadmins.org\/blog\/wp-json\/wp\/v2\/posts\/755\/revisions\/852"}],"wp:attachment":[{"href":"https:\/\/enterpriseadmins.org\/blog\/wp-json\/wp\/v2\/media?parent=755"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/enterpriseadmins.org\/blog\/wp-json\/wp\/v2\/categories?post=755"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/enterpriseadmins.org\/blog\/wp-json\/wp\/v2\/tags?post=755"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}