Home > Server 2008, Vista > How to detect Vista or Server 2008 using WMI

How to detect Vista or Server 2008 using WMI

We found ourselves wanting to target a GPO at Vista and Server 2008 machines today, and came up with this WMI query which I thought I would share, it may help someone 🙂

 

For Vista

SELECT Version, ProductType

FROM Win32_OperatingSystem

WHERE Version >= “6.0” AND ProductType = “1”

For Longhorn Server

SELECT Version, ProductType

FROM Win32_OperatingSystem WHERE

Version >= “6.0” AND ProductType = “3”

Product Type has three possible values:

Value

Description

1 Work Station
2 Domain Controller
3 Server

 

More information can be found at http://msdn.microsoft.com/en-gb/library/aa394239.aspx

 

Version number can be any of the following

Version No. Description
6.0 Windows Server 2008
6.0 Windows Vista
5.2 Windows Server 2003 R2
5.2 Windows Server 2003
5.1 Windows XP
5.0 Windows 2000

 

Sorry no link to a list of versions, if anyone has a link, I would gladly modify the post to include it.

Or you could just use:

select * from Win32_OperatingSystem where Caption like ‘%Vista%

Hope this helps someone

Advertisements
Categories: Server 2008, Vista
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: