WilliamLam.com

  • About
    • About
    • Privacy
  • VMware Cloud Foundation
  • VKS
  • Homelab
    • Hardware Options
    • Hardware Reviews
    • Lab Deployment Scripts
    • Nested Virtualization
    • Homelab Podcasts
  • VMware Nostalgia
  • Apple
You are here: Home / Uncategorized / Quick Tip - Using PowerCLI to query VMware Tools Configuration at scale 

Quick Tip - Using PowerCLI to query VMware Tools Configuration at scale 

10.11.2024 by William Lam // Leave a Comment

One of the most powerful and versatile VM management capability in vSphere is the Guest Operations API, providing a rich set of operations from transferring files to/from the guest to running commands directly on the guest as if you were logged in!

An easy way to consume the Guest Operations API is via PowerCLI and using the Invoke-VMScript cmdlet, which I have extensively written about, showcasing all the creative ways this can be used to solve various automation challenges.

I recently came across a Reddit thread where the OP wanted to check to query for a specific VMware Tools configuration as part of the vSphere Security Configuration Guide and was looking for some help as logging into each and every system did not seem like a good idea, which it is NOT! 🙂

Any time you have a use case where you need to scale a specific operation (reading or writing) a change, you should consider Guest Operations API, you can easily use a single API to perform this operation at scale!

The command the OP was looking to run on a Windows Guest is the following: C:\Program Files\VMware\VMware Tools\VMwareToolboxCmd.exe config get autoupgrade allow-add-feature


Note: Guest Operations API can be used for any GuestOS that has VMware Tools installed and is not limited to just Windows-based OSes

Here is an example of using Invoke-VMScript to run the exact same command and of course, you will need proper guest credentials and then we can easily save the output to a variable name $results to then access for further processing:

$results = Invoke-VMScript -VM $vm -GuestUser "VMware" -GuestPassword "VMware1!" -ScriptText '"C:\Program Files\VMware\VMware Tools\VMwareToolboxCmd.exe" config get autoupgrade allow-add-feature' -ScriptType Bat
$results.ScriptOutput

Here is the output after running the above snippet and we get the exact same value as

More from my site

  • Quick Tip - Requirements for using Guest Operation APIs (Invoke-VMScript & Copy-VMGuestFile) in VMC
  • Using vSphere Guest Operations API on macOS Guests? 
  • Using PowerCLI to invoke Guest Operations API to a Nested ESXi VM
  • Quick Tip - Suppress in-guest VMware Tools update notifications
  • Quick Tip - Retrieving vSAN File Share Network Permissions using vSAN API & PowerCLI

Categories // Uncategorized Tags // guest operations, PowerCLI, vmware tools

Thanks for the comment!Cancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Search

Thank Author

Author

William is Distinguished Platform Engineering Architect in the VMware Cloud Foundation (VCF) Division at Broadcom. His primary focus is helping customers and partners build, run and operate a modern Private Cloud using the VMware Cloud Foundation (VCF) platform.

Connect

  • Bluesky
  • Email
  • GitHub
  • LinkedIn
  • Mastodon
  • Reddit
  • RSS
  • Twitter
  • Vimeo

Recent

  • Crowdsourced Lab Hardware for ESXi 9.0 Dashboard 06/17/2025
  • Automating the vSAN Data Migration Pre-check using vSAN API 06/04/2025
  • VCF 9.0 Hardware Considerations 05/30/2025
  • VMware Flings is now available in Free Downloads of Broadcom Support Portal (BSP) 05/19/2025
  • VMUG Connect 2025 - Minimal VMware Cloud Foundation (VCF) 5.x in a Box  05/15/2025

Advertisment

Privacy & Cookies: This site uses cookies. By continuing to use this website, you agree to their use.
To find out more, including how to control cookies, see here: Cookie Policy

Copyright WilliamLam.com © 2025

 

Loading Comments...