{"id":2265,"date":"2025-05-21T21:07:16","date_gmt":"2025-05-22T01:07:16","guid":{"rendered":"https:\/\/enterpriseadmins.org\/blog\/?p=2265"},"modified":"2025-05-21T21:07:16","modified_gmt":"2025-05-22T01:07:16","slug":"using-gueststore-to-deliver-content-to-network-isolated-vms-in-vsphere","status":"publish","type":"post","link":"https:\/\/enterpriseadmins.org\/blog\/scripting\/using-gueststore-to-deliver-content-to-network-isolated-vms-in-vsphere\/","title":{"rendered":"Using GuestStore to Deliver Content to Network-Isolated VMs in vSphere"},"content":{"rendered":"\n<p>When working with VMs that lack network connectivity, transferring files can be tricky.  I recently explored the GuestStore feature a built-in vSphere feature that solves this challenge by allowing file delivery via VMware Tools\u2014even without a network. This post walks through how I used GuestStore to push a script into a TinyCore Linux VM with no network, CD drive, or external storage options.  <\/p>\n\n\n\n<p>The vSphere documentation does a good job explaining what GuestStore is and how it can be used: Distributing Content with GuestStore &#8211; <a href=\"https:\/\/techdocs.broadcom.com\/us\/en\/vmware-cis\/vsphere\/vsphere\/8-0\/vsphere-virtual-machine-administration-guide-8-0\/managing-virtual-machinesvsphere-vm-admin\/distributing-content-with-gueststorevsphere-vm-admin.html\">https:\/\/techdocs.broadcom.com\/us\/en\/vmware-cis\/vsphere\/vsphere\/8-0\/vsphere-virtual-machine-administration-guide-8-0\/managing-virtual-machinesvsphere-vm-admin\/distributing-content-with-gueststorevsphere-vm-admin.html<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Configuring ESXi Hosts for GuestStore<\/h2>\n\n\n\n<p>To begin, I configured all of the hosts in a cluster to use the same NFS datastore as a gueststore repository.  The official docs linked above show how to do this per host with <code>esxcli<\/code> so I used that example to write a PowerCLI equilivant.  This example uses one host has a reference to create the arguments, populates the URL value, then sets the value for each host in cluster <code>NestedCluster03<\/code>.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$setRepo = (Get-VMHost test-vesx-71* | Get-EsxCli -v2).system.settings.gueststore.repository.set.CreateArgs()\n$setRepo.url = 'ds:\/\/\/vmfs\/volumes\/ebb8ed5e-48fb2f0b\/h045-gueststore'\n\nforeach ($thisHost in (Get-Cluster NestedCluster03 | Get-VMHost | Sort-Object Name )) {\n  ($thisHost | Get-EsxCli -v2).system.settings.gueststore.repository.set.Invoke($setRepo)\n}<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Preparing the Content \/ sample script<\/h2>\n\n\n\n<p>This sets a datastore folder named <code>h045-gueststore<\/code> as the base folder for my custom content.  I then created a script file to demonstrate how to get this file to the VM.  The full path of the test file would be <code>[nfs-datastore-a] h045-gueststore\/custom\/myscript.sh<\/code>.  This script will write the current date\/time value from the system, dot source the os-release file, and then write the &#8216;pretty name&#8217; of the OS to the screen:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#!\/bin\/sh\necho \"The current system time is $(date)\"\n. \/etc\/os-release\necho \"This system is running ${PRETTY_NAME}.\"<\/code><\/pre>\n\n\n\n<p>This is a basic shell script.  It is just a sample, we could use this same method to distribute any script or binary file that is 512MB or less.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Guest VM Retrieval with VMware Tools<\/h2>\n\n\n\n<p>I then deployed a TinyCore Linux VM, which is super small (my OVA is less than 30MB, including open-vm-tools) and perfect for this type of testing as it deploys very quickly.  In this example, the TinyCore VM has no network adapter, CD\/DVD drive, or floppy drive that could be used to access script files or other binaries.  It does run in the <code>NestedCluster03<\/code> which has GuestStore configured.<\/p>\n\n\n\n<p>Inside the guest OS we&#8217;ll run the following command to retrieve the file:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/usr\/local\/bin\/vmware-toolbox-cmd gueststore getcontent \/custom\/myscript.sh \/tmp\/myscript.sh<\/code><\/pre>\n\n\n\n<p>Since this file is only a few KB in size, we should see a complete progress bar almost immediately, with confirmation that &#8216;getcontent&#8217; succeeded, as pictured below.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/enterpriseadmins.org\/blog\/wp-content\/uploads\/2025\/05\/image.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"234\" src=\"https:\/\/enterpriseadmins.org\/blog\/wp-content\/uploads\/2025\/05\/image-1024x234.png\" alt=\"\" class=\"wp-image-2271\" srcset=\"https:\/\/enterpriseadmins.org\/blog\/wp-content\/uploads\/2025\/05\/image-1024x234.png 1024w, https:\/\/enterpriseadmins.org\/blog\/wp-content\/uploads\/2025\/05\/image-300x69.png 300w, https:\/\/enterpriseadmins.org\/blog\/wp-content\/uploads\/2025\/05\/image-768x176.png 768w, https:\/\/enterpriseadmins.org\/blog\/wp-content\/uploads\/2025\/05\/image-1536x351.png 1536w, https:\/\/enterpriseadmins.org\/blog\/wp-content\/uploads\/2025\/05\/image.png 1780w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Running the Script<\/h2>\n\n\n\n<p>From here we can make our script executable (<code>chmod +x \/tmp\/myscript.sh<\/code>) and then run it (<code>\/tmp\/myscript.sh<\/code>).  <\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/enterpriseadmins.org\/blog\/wp-content\/uploads\/2025\/05\/image-1.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"169\" src=\"https:\/\/enterpriseadmins.org\/blog\/wp-content\/uploads\/2025\/05\/image-1-1024x169.png\" alt=\"\" class=\"wp-image-2278\" srcset=\"https:\/\/enterpriseadmins.org\/blog\/wp-content\/uploads\/2025\/05\/image-1-1024x169.png 1024w, https:\/\/enterpriseadmins.org\/blog\/wp-content\/uploads\/2025\/05\/image-1-300x49.png 300w, https:\/\/enterpriseadmins.org\/blog\/wp-content\/uploads\/2025\/05\/image-1-768x126.png 768w, https:\/\/enterpriseadmins.org\/blog\/wp-content\/uploads\/2025\/05\/image-1.png 1257w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<p>This script creates a very basic output, but its just a starting point. The real key here isn&#8217;t the script, its the process of getting the script to the virtual machine which does not have an alternate method of file transfer.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p>Configuring GuestStore on ESXi hosts wasn&#8217;t difficult.  Using VMware Tools to get these files into the guest OS was also straightforward.  While there are many ways to get files into a virtual machine, this worked well in this specific case where the VM didn&#8217;t have a CD drive or functioning network connectivity.  <\/p>\n","protected":false},"excerpt":{"rendered":"<p>When working with VMs that lack network connectivity, transferring files can be tricky. I recently explored the GuestStore feature a built-in vSphere feature that solves this challenge by allowing file delivery via VMware Tools\u2014even without a network. This post walks &hellip; <a href=\"https:\/\/enterpriseadmins.org\/blog\/scripting\/using-gueststore-to-deliver-content-to-network-isolated-vms-in-vsphere\/\">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-2265","post","type-post","status-publish","format-standard","hentry","category-scripting","category-virtualization"],"_links":{"self":[{"href":"https:\/\/enterpriseadmins.org\/blog\/wp-json\/wp\/v2\/posts\/2265","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=2265"}],"version-history":[{"count":5,"href":"https:\/\/enterpriseadmins.org\/blog\/wp-json\/wp\/v2\/posts\/2265\/revisions"}],"predecessor-version":[{"id":2279,"href":"https:\/\/enterpriseadmins.org\/blog\/wp-json\/wp\/v2\/posts\/2265\/revisions\/2279"}],"wp:attachment":[{"href":"https:\/\/enterpriseadmins.org\/blog\/wp-json\/wp\/v2\/media?parent=2265"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/enterpriseadmins.org\/blog\/wp-json\/wp\/v2\/categories?post=2265"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/enterpriseadmins.org\/blog\/wp-json\/wp\/v2\/tags?post=2265"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}