James.Random()

James Senior at Microsoft: Like a kid in a candy store

How to detect Vista and Longhorn with WMI Filters

How to detect Vista and Longhorn with WMI Filters

  • Comments 4
  • Likes

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: , , ,

Comments
  • James Senior has a post on his blog “Views on Vista” that details how to build WMI filters

  • 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.

  • Once upon a time, in a kingdom near you, there was a Server. A king. And the King Server liked to rule

  • 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!

Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment