How to detect Vista and Longhorn with WMI Filters

This ones for the IT admins out there.  When applying Group Policy Objects (GPOs) in active directory using WMI Filters, you can figure out whether a computer is running Vista or Longhorn Server by using the following queries:

For Vista 

SELECT Version, ProductType

FROM Win32_OperatingSystem

WHERE Version >= '6' AND ProductType = '1'

For Longhorn Server

SELECT Version, ProductType

FROM Win32_OperatingSystem WHERE

Version >= '6' AND ProductType = '3'

 

I created a quick script to show the results (click for larger image):

 

Technorati tags: Vista, Longhorn Server, GPO, WMI