{"id":362,"date":"2011-05-17T14:43:57","date_gmt":"2011-05-17T18:43:57","guid":{"rendered":"http:\/\/enterpriseadmins.org\/blog\/?p=362"},"modified":"2011-05-17T14:43:57","modified_gmt":"2011-05-17T18:43:57","slug":"configure-virtual-machine-for-nested-esxesxi-with-powercli","status":"publish","type":"post","link":"https:\/\/enterpriseadmins.org\/blog\/scripting\/configure-virtual-machine-for-nested-esxesxi-with-powercli\/","title":{"rendered":"Configure virtual machine for nested ESX\/ESXi with PowerCLI"},"content":{"rendered":"<p>I&#8217;ve been working with several scripts in a lab recently.  Most of these labs require additional ESXi hosts (namely vCheck testing) so I&#8217;ve been propping up some nested ESXi virtual machines.  When I create a virtual machine to run nested ESXi, I typically set three advanced configuration options:<\/p>\n<pre>monitor_control.restrict_backdoor = TRUE\r\nmonitor_control.vt32 = TRUE\r\nSMBIOS.reflectHost = TRUE<\/pre>\n<ul>\n<li>The first option listed allows you to run virtual machines inside your nested ESXi installations.<\/li>\n<li>The VT32 option is specifically geared for Intel hardware; if you are using AMD hardware you&#8217;ll probably want to use monitor_control.enable_svm = TRUE instead.<\/li>\n<li>The final option is not really required; it simply makes the nested ESXi host look more like a physical server.  If you do this on an HP server, the virtual ESXi host appears as an HP instead of being a VMware, Inc. Virtual Machine Platform.<\/li>\n<\/ul>\n<p>While three copy\/paste operations into the advanced settings window isn&#8217;t challenging or time consuming, I thought it would be better if this could be done with PowerCLI.<\/p>\n<pre><code class=\"language-powershell\">\r\n#Monitor Control\/Restrict Backdoor\r\n$extrarbd = New-Object VMware.Vim.optionvalue\r\n$extrarbd.Key=\"monitor_control.restrict_backdoor\"\r\n$extrarbd.Value=\"TRUE\"\r\n\r\n#Monitor Control\/VT32\r\n$extravt32 = New-Object VMware.Vim.optionvalue\r\n$extravt32.Key=\"monitor_control.vt32\"\r\n$extravt32.Value=\"TRUE\"\r\n\r\n#SMBIOS\/Reflect Host\r\n$extraref = New-Object VMware.Vim.optionvalue\r\n$extraref.Key=\"SMBIOS.reflectHost\"\r\n$extraref.Value=\"TRUE\"\r\n\r\n#Create a Machine Config Spec using the three option values specified above\r\n$vmConfigSpec = New-Object VMware.Vim.VirtualMachineConfigSpec\r\n$vmConfigSpec.extraconfig += $extrarbd\r\n$vmConfigSpec.extraconfig += $extravt32\r\n$vmConfigSpec.extraconfig += $extraref\r\n\r\n#Get a VM View collection of all the VMs that need to have these options\r\n$vms = get-view -viewtype virtualmachine |where {$_.name -eq \"mytestesxi01\"}\r\nforeach($vm in $vms){\r\n$vm.ReconfigVM($vmConfigSpec)\r\n}\r\n<\/code><\/pre>\n<p>I&#8217;ve used this on two virtual machines and it appears to work okay.  Please feel free to drop a comment if you have any questions.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;ve been working with several scripts in a lab recently. Most of these labs require additional ESXi hosts (namely vCheck testing) so I&#8217;ve been propping up some nested ESXi virtual machines. When I create a virtual machine to run nested &hellip; <a href=\"https:\/\/enterpriseadmins.org\/blog\/scripting\/configure-virtual-machine-for-nested-esxesxi-with-powercli\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":6,"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-362","post","type-post","status-publish","format-standard","hentry","category-scripting","category-virtualization"],"_links":{"self":[{"href":"https:\/\/enterpriseadmins.org\/blog\/wp-json\/wp\/v2\/posts\/362","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\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/enterpriseadmins.org\/blog\/wp-json\/wp\/v2\/comments?post=362"}],"version-history":[{"count":6,"href":"https:\/\/enterpriseadmins.org\/blog\/wp-json\/wp\/v2\/posts\/362\/revisions"}],"predecessor-version":[{"id":368,"href":"https:\/\/enterpriseadmins.org\/blog\/wp-json\/wp\/v2\/posts\/362\/revisions\/368"}],"wp:attachment":[{"href":"https:\/\/enterpriseadmins.org\/blog\/wp-json\/wp\/v2\/media?parent=362"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/enterpriseadmins.org\/blog\/wp-json\/wp\/v2\/categories?post=362"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/enterpriseadmins.org\/blog\/wp-json\/wp\/v2\/tags?post=362"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}