Forum Discussion

PepeLePew's avatar
PepeLePew
Copper Contributor
Feb 21, 2026
Solved

WMI Filter for non-Hyper-V Host

I have been struggling for several days trying to set a GPO WMI Filter that would apply settings to any server, virtual or physical, as long as it is not the Hyper-V Host. It should apply to any VM on VMWare or on Hyper-V hypervisors.

I found many suggestions online but none of them really work, like looking for Hypervisorpresent, that is also set to TRUE on VMs so no help. I have many ways to find and apply to an Hyper-V but EXCLUDING Hyper-Vs seems to be a tough one, the WMI filters are designed to find something and apply if it finds it, not the opposite. I have tried queries on the OptionalFeatures class, again it helps me find the Hyper-V but not EXCLUDE it. 

Anyone have an idea about doing this.

BTW, this is to apply a setting only to non-Hyper-V and ignore if it is an Hyper-V. I am also trying to avoid blocking GPOs at a specific OU and re-linking all but 1 GPO from that level, I have to assume that there is a way to target all servers except Hyper-V.

Hopefully someone has succeeded in doing the same.

 

Thank you

2 Replies

  • Jack36's avatar
    Jack36
    Copper Contributor

    Recommended WMI Filter to Exclude Hyper-V Hosts

     

    If you want to target all servers except the actual Hyper-V Host, checking for the hypervisor service is often more reliable than 'HypervisorPresent'. You can try a WMI query that checks for the absence of the Hyper-V service or specific hardware markers.

     

    Try this query to target machines that are NOT Hyper-V hosts:

     

    SELECT * FROM Win32_Service WHERE Name = 'hvboot' AND State <> 'Running'

     

    Alternatively, you can filter by the computer model if you are mostly using virtual machines:

     

    SELECT * FROM Win32_ComputerSystem WHERE NOT Model LIKE '%Virtual%'

     

    However, for a more precise exclusion of the Hyper-V role, checking the Win32_OptionalFeature for the 'Microsoft-Hyper-V' status and ensuring it is not 'Enabled' is the way to go.

     

    Hope this helps you filter out the hosts effectively!

  • Francisco_M's avatar
    Francisco_M
    Brass Contributor

    Hyper‑V hosts always have the Hyper‑V role installed, which means the Hyper‑V virtualization service is present on the host OS.

    The simplest and most stable WMI filter is:

    Apply to all servers where the Hyper‑V role is NOT installed

    SELECT * FROM Win32_OperatingSystem

    WHERE ProductType = 3

    AND NOT EXISTS (

    SELECT * FROM Win32_ServerFeature WHERE ID = 63

    )