{"id":9944,"date":"2024-12-09T22:00:21","date_gmt":"2024-12-09T21:00:21","guid":{"rendered":"https:\/\/michlstechblog.info\/blog\/?p=9944"},"modified":"2024-12-10T17:21:23","modified_gmt":"2024-12-10T16:21:23","slug":"vmware-vsphere-pass-variables-from-vcenter-into-a-virtual-machine","status":"publish","type":"post","link":"https:\/\/michlstechblog.info\/blog\/vmware-vsphere-pass-variables-from-vcenter-into-a-virtual-machine\/","title":{"rendered":"VMware vSphere: Pass variables from vCenter into a virtual machine"},"content":{"rendered":"<div class=\"twoclick_social_bookmarks_post_9944 social_share_privacy clearfix 1.6.4 locale-en_US sprite-en_US\"><\/div><div class=\"twoclick-js\"><script type=\"text\/javascript\">\/* <![CDATA[ *\/\njQuery(document).ready(function($){if($('.twoclick_social_bookmarks_post_9944')){$('.twoclick_social_bookmarks_post_9944').socialSharePrivacy({\"services\":{\"flattr\":{\"uid\":\"Michl\",\"status\":\"on\",\"the_title\":\"VMware%20vSphere%3A%20Pass%20variables%20from%20vCenter%20into%20a%20virtual%20machine\",\"the_excerpt\":\"Hi%2C%0D%0A%0D%0Athis%20%20post%20describes%20on%20how%20to%20to%20pass%20data%2C%20for%20example%20a%20variable%2C%20from%20vCenter%20into%20a%20virtual%20machine.%0D%0A%20%28more%26hellip%3B%29\",\"txt_info\":\"2 clicks for more data protection:\\r\\n\\r\\nOnly when you click here, the button will be come active and you can send your recommendation to Flattr. When activating, data are transmitted to third parties. \",\"perma_option\":\"off\"}},\"txt_help\":\"When you activate these fields by clicking, information to Flattr may be transferred abroad, and probably may also stored there.\",\"settings_perma\":\"Enable permanently and accept data transmission. \",\"info_link\":\"http:\\\/\\\/www.heise.de\\\/ct\\\/artikel\\\/2-Klicks-fuer-mehr-Datenschutz-1333879.html\",\"uri\":\"https:\\\/\\\/michlstechblog.info\\\/blog\\\/vmware-vsphere-pass-variables-from-vcenter-into-a-virtual-machine\\\/\",\"post_id\":9944,\"post_title_referrer_track\":\"VMware+vSphere%3A+Pass+variables+from+vCenter+into+a+virtual+machine\",\"display_infobox\":\"on\"});}});\n\/* ]]> *\/<\/script><\/div><p>Hi,<\/p>\n<p>this  post describes on how to to pass data, for example a variable, from vCenter into a virtual machine.<br \/>\n<!--more--><\/p>\n<p>If VMware tools are installed you can read all &#8220;guestinfo.*&#8221; variables within the virtual machine.<\/p>\n<p>Get with Powercli all guestInfo variables set at the virtual machine:<\/p>\n<pre class=\"brush: powershell; title: ; notranslate\" title=\"\">\r\nPS D:\\&gt; get-vm MyVM | Get-AdvancedSetting guestinfo.* | ft -AutoSize\r\n\r\nName                                  Value\r\n----                                  -----\r\nguestInfo.detailed.data               architecture='X86' bitness='64' buildNumber='22631' distroName='Windows' d\r\nguestinfo.Cb.InstallStatus            3013\r\nguestinfo.Cb.LauncherVersion          1.3.1\r\nguestinfo.driver.vmci.version         9.8.18.0\r\nguestinfo.driver.vsock.version        9.8.22.0\r\nguestinfo.driver.wddm.version         9.17.08.0009\r\nguestinfo.vmtools.buildNumber         24276846\r\nguestinfo.vmtools.description         VMware Tools 12.5.0 build 24276846\r\nguestinfo.vmtools.versionNumber       12448\r\nguestinfo.vmtools.versionString       12.5.0\r\nguestinfo.vmware.components.available salt_minion\r\nguestinfo.appInfo                     {... \r\n<\/pre>\n<p>Then logon to your VMware and try to read those variables. You can use vmtoolsd.exe or rpctool.exe<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nD:\\&gt; &quot;C:\\Program Files\\VMware\\VMware Tools\\vmtoolsd.exe&quot; config --cmd &quot;info-get guestinfo.appinfo&quot;\r\nD:\\&gt; &quot;C:\\Program Files\\VMware\\VMware Tools\\rpctool.exe&quot; &quot;info-get guestinfo.appinfo&quot;\r\n{\r\n&quot;version&quot;:&quot;1&quot;,\r\n&quot;updateCounter&quot;:&quot;21&quot;,\r\n&quot;publishTime&quot;:&quot;2024-12-10T13:35:26.661Z&quot;,\r\n&quot;applications&quot;:&#x5B;\r\n{&quot;a&quot;:&quot;&#x5B;System Process]&quot;,&quot;v&quot;:&quot;&quot;},\r\n{&quot;a&quot;:&quot;MsMpEng.exe&quot;,&quot;v&quot;:&quot;4.18.24090.11&quot;},\r\n{&quot;a&quot;:&quot;MsSense.exe&quot;,&quot;v&quot;:&quot;10.8775.27682.1012&quot;},\r\n{&quot;a\r\n<\/pre>\n<p>But how to set your own variable?<\/p>\n<pre class=\"brush: powershell; title: ; notranslate\" title=\"\">\r\nPS D:\\&gt; get-vm myVM | New-AdvancedSetting -Name guestinfo.myvariable -Value &quot;TEST&quot; -confirm:$false\r\n<\/pre>\n<p>Or change an existing variable<\/p>\n<pre class=\"brush: powershell; title: ; notranslate\" title=\"\">\r\nPS D:\\&gt;get-vm myVM |  Get-AdvancedSetting -Name guestinfo.myvariable | Set-AdvancedSetting -Value &quot;TEST&quot; -confirm:$false\r\n<\/pre>\n<p>And in the VM it looks like<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nD:\\&gt; &quot;C:\\Program Files\\VMware\\VMware Tools\\rpctool.exe&quot; &quot;info-get guestinfo.myvariable&quot;\r\nTEST1\r\n<\/pre>\n<p>Michael<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hi, this post describes on how to to pass data, for example a variable, from vCenter into a virtual machine.<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[1263,457,2064,956,1798,86,283],"class_list":["post-9944","post","type-post","status-publish","format-standard","hentry","category-vmware","tag-access","tag-esxi","tag-into","tag-pass","tag-variable","tag-vcenter","tag-virtual-machine"],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/posts\/9944","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/comments?post=9944"}],"version-history":[{"count":4,"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/posts\/9944\/revisions"}],"predecessor-version":[{"id":9948,"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/posts\/9944\/revisions\/9948"}],"wp:attachment":[{"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/media?parent=9944"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/categories?post=9944"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/tags?post=9944"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}