Configuration Manager Collection Query for Virtual Machines
This WQL query builds a Configuration Manager collection containing only virtual machines — useful for scoping maintenance windows, patching schedules, or software deployments differently between your physical and virtual estate, since VMs often have different patching cadences or reboot tolerances than physical hardware.select SMS_R_SYSTEM.ResourceId, SMS_R_SYSTEM.ResourceType, SMS_R_SYSTEM.Name, SMS_R_SYSTEM.SMSUniqueIdentifier, SMS_R_SYSTEM.ResourceDomainORWorkgroup, SMS_R_SYSTEM.Client from SMS_R_System inner join SMS_G_System_COMPUTER_SYSTEM on SMS_G_System_COMPUTER_SYSTEM.ResourceID = SMS_R_System.ResourceId where SMS_G_System_COMPUTER_SYSTEM.Model in ("VMware Virtual Platform", "Virtual Machine", "VirtualBox")
The Model values in the where clause correspond to the common hypervisor signatures reported by VMware, Hyper-V, and VirtualBox respectively — if you run a different hypervisor, check what your own VMs report for Model in hardware inventory (v_GS_COMPUTER_SYSTEM) first and add that value to the list, since not every hypervisor reports the same string.
Common Model Strings by Hypervisor
Since guessing the exact string is unreliable, here are the values most commonly seen for the major platforms — worth adding to thein (...) list above if you run a mixed estate:
Hyper-V: Virtual Machine VMware: VMware Virtual Platform, VMware7,1 (and other "VMwareNN,N" variants) VirtualBox: VirtualBox Nutanix AHV: AHV KVM/QEMU: Standard PC (Q35 + ICH9, 2009), Standard PC (i440FX + PIIX, 1996) Xen: HVM domUNewer VMware ESXi hosts have started reporting numbered platform strings that include the VM’s hardware version (e.g.
VMware7,1) instead of the classic VMware Virtual Platform string, and the exact number changes as newer hardware versions ship — so a query built purely against the old value can silently miss VMs on newer hosts. Worth re-checking your own environment’s actual reported Model values periodically (via a quick hardware inventory report) rather than assuming the original list still covers everything.
A More Resilient Alternative: Checking the Manufacturer Field
Rather than matching an ever-growing list of exactModel strings, some admins instead flag anything where Manufacturer isn’t a physical hardware vendor (Dell, HP, Lenovo, and so on), which catches new or unlisted hypervisor signatures automatically at the cost of needing your physical-vendor exclusion list kept current instead. Neither approach is fully maintenance-free — pick whichever list (hypervisors you have, or vendors you have) is shorter and more stable in your environment.
Resources
Gear We Recommend
Running this in a home lab? Here’s the gear that keeps our test environment reliable.
Browse our Home Lab Essentials picks on AmazonAs an Amazon Associate, TechyGeeksHome earns from qualifying purchases.
Discover more from TechyGeeksHome
Subscribe to get the latest posts sent to your email.