Discussion:
WMI Filters
(too old to reply)
Cary Shultz
2010-04-07 09:31:47 UTC
Permalink
Good morning from beautiful SW Virginia! Schoenen Guten Morgen!

Long post - but not as long as it looks. The nuts and bolts are:

1) most clients that we manage are WIN2003/WINXP
2) I have WMI Filters to filter client-side OS (using Win32_Processor |
AddressWidth)
3) Windows 7 is now slowing being introduced
4) Need to update WMI Filters to reflect this (some applications have a
Windows XP | Vista Version and a different Windows 7 Version)
5) Thinking of using Win32_OperatingSystem | Version=5.1.2600
6) Concerned that using explicit Version number might cause issues
"tomorrow" so thinking that using Version LIKE '5.1.%' would be better
7) Concerned that processing time might be longer if using a
variable|wildcard instead of explicit version number
8) No available lab in which to test....so asking here






The "long-winded" version is below.......

Please forgive me if I have asked this question already. I am not sure that
I have not....just do not remember the answer (and could not find it....I
looked). I tend to move from 'project' to 'project' at work and am now on
this (again!).

So, we manage a lot of clients and most of them are Windows 2003
(server-side) and Windows XP (client-side). In fact, all but about 40
workstations are Windows XP so having the "old-school" WMI Filters works
just swell. I have one for 32-bit machines (SELECT AddressWidth FROM
Win32_Processor WHERE AddressWidth ='32') and I have one for 64-bit machines
(SELECT AddressWidth FROM Win32_Processor WHERE AddressWidth ='64'). No
worries. I deploy several apps via GPO and use the appropriate WMI Filter
if there is a 32-bit version and 64-bit version of the application (think,
for example, MBSA 2.1 or UPHCleaner).

So, along comes Windows 7 (most of our clients have specifically overlooked
Windows Vista - not all, just most). With respect to what I do (read:
deploy software - as per the above example) I now really need to update my
WMI Filters. MBSA 2.1.1 - for example - works much better on Windows 7 than
does MBSA 2.1.0. I really do not want MBSA 2.1.0 to be deployed to any WIN7
machines....

So, to the question:

I can filter the OS based on Version but it seems like I have a couple of
options here. I can use the following:

==================================================================================
Windows XP
Select Version, ProductType from Win32_OperatingSystem WHERE
Version='5.1.2600' and ProductType='1'

Windows Vista
Select Version, ProductType FROM Win32_OperatingSystem WHERE
Version='6.0.6002' and ProductType='1'

Windows 7
SELECT Version, ProductType FROM Win32_OperatingSystem WHERE
Version='6.1.7600' and ProductType='1'
===================================================================================

This explicitly lists the version of the OS. I am all for that. I like
that. I have used a vbs script to determine the version attribute on
several different OSes and using the values above will not cause any
issues - today. But, I am thinking that it *COULD* be a bit short-sighted
(who knows what MS will do, right?). Naturally, adding that "and
ProductType='1'" is super important. To combat this, I could, however, do
the following:


===================================================================================
Windows XP
Select Version, ProductType from Win32_OperatingSystem WHERE Version LIKE
'5.1.%' and ProductType='1'

Windows Vista
Select Version, ProductType FROM Win32_OperatingSystem WHERE Version LIKE
'6.0.%' and ProductType='1'

Windows 7
SELECT Version, ProductType FROM Win32_OperatingSystem WHERE Version LIKE
'6.1.%' and ProductType='1'

====================================================================================

I am pretty sure that this would not cause any issues. But, before I roll
this out to thousands of machines I would like to check....to make sure that
my brain is not missing something. Specifically, I want to make sure that
processing this WMI Filter - now that there will be a variable/wildcard in
it - is not going to noticeably add to the time it takes for this stuff to
be processed. Our clients are really picky when it comes to how long it
takes for their machines to start up | reboot. I really think that some of
them break out the stop watch for this event! Gotta love them.

I do not have an available lab in which to test this. So, I am asking.

Thanks,

Cary
ZEDA
2010-04-07 11:40:09 UTC
Permalink
Hi Cary,

The filter should do the trick and won't be slow either (0.2 seconds on
my system):

SELECT * FROM Win32_OperatingSystem WHERE Version = "6.1%" and
ProductType = "1"

You can test the speed of the query on the powershell:

measure-Command {Get-WmiObject -query 'SELECT * FROM
Win32_OperatingSystem WHERE Version = "6.1%" and ProductType = "1"'}

Good luck.

ZEDA


More on WMI filters: http://zeda.nl/en/?postid=20100327A
Post by Cary Shultz
Good morning from beautiful SW Virginia! Schoenen Guten Morgen!
1) most clients that we manage are WIN2003/WINXP
2) I have WMI Filters to filter client-side OS (using Win32_Processor |
AddressWidth)
3) Windows 7 is now slowing being introduced
4) Need to update WMI Filters to reflect this (some applications have a
Windows XP | Vista Version and a different Windows 7 Version)
5) Thinking of using Win32_OperatingSystem | Version=5.1.2600
6) Concerned that using explicit Version number might cause issues
"tomorrow" so thinking that using Version LIKE '5.1.%' would be better
7) Concerned that processing time might be longer if using a
variable|wildcard instead of explicit version number
8) No available lab in which to test....so asking here
The "long-winded" version is below.......
Please forgive me if I have asked this question already. I am not sure
that I have not....just do not remember the answer (and could not find
it....I looked). I tend to move from 'project' to 'project' at work and
am now on this (again!).
So, we manage a lot of clients and most of them are Windows 2003
(server-side) and Windows XP (client-side). In fact, all but about 40
workstations are Windows XP so having the "old-school" WMI Filters works
just swell. I have one for 32-bit machines (SELECT AddressWidth FROM
Win32_Processor WHERE AddressWidth ='32') and I have one for 64-bit
machines (SELECT AddressWidth FROM Win32_Processor WHERE AddressWidth
='64'). No worries. I deploy several apps via GPO and use the
appropriate WMI Filter if there is a 32-bit version and 64-bit version
of the application (think, for example, MBSA 2.1 or UPHCleaner).
So, along comes Windows 7 (most of our clients have specifically
overlooked Windows Vista - not all, just most). With respect to what I
do (read: deploy software - as per the above example) I now really need
to update my WMI Filters. MBSA 2.1.1 - for example - works much better
on Windows 7 than does MBSA 2.1.0. I really do not want MBSA 2.1.0 to be
deployed to any WIN7 machines....
I can filter the OS based on Version but it seems like I have a couple
==================================================================================
Windows XP
Select Version, ProductType from Win32_OperatingSystem WHERE
Version='5.1.2600' and ProductType='1'
Windows Vista
Select Version, ProductType FROM Win32_OperatingSystem WHERE
Version='6.0.6002' and ProductType='1'
Windows 7
SELECT Version, ProductType FROM Win32_OperatingSystem WHERE
Version='6.1.7600' and ProductType='1'
===================================================================================
This explicitly lists the version of the OS. I am all for that. I like
that. I have used a vbs script to determine the version attribute on
several different OSes and using the values above will not cause any
issues - today. But, I am thinking that it *COULD* be a bit
short-sighted (who knows what MS will do, right?). Naturally, adding
that "and ProductType='1'" is super important. To combat this, I could,
===================================================================================
Windows XP
Select Version, ProductType from Win32_OperatingSystem WHERE Version
LIKE '5.1.%' and ProductType='1'
Windows Vista
Select Version, ProductType FROM Win32_OperatingSystem WHERE Version
LIKE '6.0.%' and ProductType='1'
Windows 7
SELECT Version, ProductType FROM Win32_OperatingSystem WHERE Version
LIKE '6.1.%' and ProductType='1'
====================================================================================
I am pretty sure that this would not cause any issues. But, before I
roll this out to thousands of machines I would like to check....to make
sure that my brain is not missing something. Specifically, I want to
make sure that processing this WMI Filter - now that there will be a
variable/wildcard in it - is not going to noticeably add to the time it
takes for this stuff to be processed. Our clients are really picky when
it comes to how long it takes for their machines to start up | reboot. I
really think that some of them break out the stop watch for this event!
Gotta love them.
I do not have an available lab in which to test this. So, I am asking.
Thanks,
Cary
--
Zeda.nl - Windows Advanced Tips & Tricks
Cary Shultz
2010-04-07 11:46:30 UTC
Permalink
Zeda,

Thank you mucho!

Cary
Post by ZEDA
Hi Cary,
The filter should do the trick and won't be slow either (0.2 seconds on my
SELECT * FROM Win32_OperatingSystem WHERE Version = "6.1%" and ProductType
= "1"
measure-Command {Get-WmiObject -query 'SELECT * FROM Win32_OperatingSystem
WHERE Version = "6.1%" and ProductType = "1"'}
Good luck.
ZEDA
More on WMI filters: http://zeda.nl/en/?postid=20100327A
Post by Cary Shultz
Good morning from beautiful SW Virginia! Schoenen Guten Morgen!
1) most clients that we manage are WIN2003/WINXP
2) I have WMI Filters to filter client-side OS (using Win32_Processor |
AddressWidth)
3) Windows 7 is now slowing being introduced
4) Need to update WMI Filters to reflect this (some applications have a
Windows XP | Vista Version and a different Windows 7 Version)
5) Thinking of using Win32_OperatingSystem | Version=5.1.2600
6) Concerned that using explicit Version number might cause issues
"tomorrow" so thinking that using Version LIKE '5.1.%' would be better
7) Concerned that processing time might be longer if using a
variable|wildcard instead of explicit version number
8) No available lab in which to test....so asking here
The "long-winded" version is below.......
Please forgive me if I have asked this question already. I am not sure
that I have not....just do not remember the answer (and could not find
it....I looked). I tend to move from 'project' to 'project' at work and
am now on this (again!).
So, we manage a lot of clients and most of them are Windows 2003
(server-side) and Windows XP (client-side). In fact, all but about 40
workstations are Windows XP so having the "old-school" WMI Filters works
just swell. I have one for 32-bit machines (SELECT AddressWidth FROM
Win32_Processor WHERE AddressWidth ='32') and I have one for 64-bit
machines (SELECT AddressWidth FROM Win32_Processor WHERE AddressWidth
='64'). No worries. I deploy several apps via GPO and use the
appropriate WMI Filter if there is a 32-bit version and 64-bit version
of the application (think, for example, MBSA 2.1 or UPHCleaner).
So, along comes Windows 7 (most of our clients have specifically
overlooked Windows Vista - not all, just most). With respect to what I
do (read: deploy software - as per the above example) I now really need
to update my WMI Filters. MBSA 2.1.1 - for example - works much better
on Windows 7 than does MBSA 2.1.0. I really do not want MBSA 2.1.0 to be
deployed to any WIN7 machines....
I can filter the OS based on Version but it seems like I have a couple
==================================================================================
Windows XP
Select Version, ProductType from Win32_OperatingSystem WHERE
Version='5.1.2600' and ProductType='1'
Windows Vista
Select Version, ProductType FROM Win32_OperatingSystem WHERE
Version='6.0.6002' and ProductType='1'
Windows 7
SELECT Version, ProductType FROM Win32_OperatingSystem WHERE
Version='6.1.7600' and ProductType='1'
===================================================================================
This explicitly lists the version of the OS. I am all for that. I like
that. I have used a vbs script to determine the version attribute on
several different OSes and using the values above will not cause any
issues - today. But, I am thinking that it *COULD* be a bit
short-sighted (who knows what MS will do, right?). Naturally, adding
that "and ProductType='1'" is super important. To combat this, I could,
===================================================================================
Windows XP
Select Version, ProductType from Win32_OperatingSystem WHERE Version
LIKE '5.1.%' and ProductType='1'
Windows Vista
Select Version, ProductType FROM Win32_OperatingSystem WHERE Version
LIKE '6.0.%' and ProductType='1'
Windows 7
SELECT Version, ProductType FROM Win32_OperatingSystem WHERE Version
LIKE '6.1.%' and ProductType='1'
====================================================================================
I am pretty sure that this would not cause any issues. But, before I
roll this out to thousands of machines I would like to check....to make
sure that my brain is not missing something. Specifically, I want to
make sure that processing this WMI Filter - now that there will be a
variable/wildcard in it - is not going to noticeably add to the time it
takes for this stuff to be processed. Our clients are really picky when
it comes to how long it takes for their machines to start up | reboot. I
really think that some of them break out the stop watch for this event!
Gotta love them.
I do not have an available lab in which to test this. So, I am asking.
Thanks,
Cary
--
Zeda.nl - Windows Advanced Tips & Tricks
Loading...