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
Comments
Anonymous
January 01, 2003
Once upon a time, in a kingdom near you, there was a Server. A king. And the King Server liked to ruleAnonymous
January 01, 2003
James Senior has a post on his blog “Views on Vista” that details how to build WMI filtersAnonymous
January 15, 2007
Is it actually valid to do a >= comparison on a string? I suppose it will do a binary comparison, but the OS Version value is a string. BTW, you forgot ProductType==2 - Domain Controller.Anonymous
August 01, 2007
Is this safe to assume it will continue to funciton for future service packs, and future versions of windwos won't be caaught by the same WMI filter? I'm suprised Vista isn't defined by name somewhere. If I change my WMI filter, and a computer was affected by the GP both before and after the change, it will not do anythign strang like re-apply the object, right? It will just continue to apply? Thanks!