[gptalk] Re: I Need The Perfect Desktop WMI Filter

  • From: "Jakob H. Heidelberg" <jakob@xxxxxxxxxxxxxxx>
  • To: <gptalk@xxxxxxxxxxxxx>
  • Date: Mon, 11 Feb 2008 09:04:55 +0100

I can't seem to make that work - in my case my laptop has 2 SystemSlots
(CardBus + Mini-PCI) and my desktop returns 2 (AGP and PCI). I'm using
Scriptomatic for this.

 

Also, using WQL I wouldn't know how to make a "count" - as that would be
needed I guess?

 

I could maybe try to go for "PCI%", as I expect most desktops to have PCI
slots (and laptops to have Mini-PCI, but that would depend on the form
factor) - or maybe AGP (does onboard VGA count as AGP? Any PCI VGA left out
there?) - something like:

 

A) Select * From Win32_SystemSlot Where SlotDesignation = "PCI%"

Or

B) Select * From Win32_SystemSlot Where SlotDesignation = "AGP"

 

Would that run through ALL slots on the machine, exactly like:

 

A)

strComputer = "."

bolFound = False

Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")

Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_SystemSlot")

For Each objItem In colItems

  If Left(Ucase(objItem.SlotDesignation),3) = "PCI" Then bolFound = True

Next

Msgbox bolFound

 

B)

strComputer = "."

bolFound = False

Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")

Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_SystemSlot")

For Each objItem In colItems

  If Ucase(objItem.SlotDesignation) = "AGP" Then bolFound = True

Next

Msgbox bolFound

 

 

If this is "true", the it might just do it - as Virtual Machines does not
have these slots I cannot test the WMI filter right now. Still not
convinced, but I think we are closer to the goal now J

 

 

Thanx!

/Jakob

 

From: gptalk-bounce@xxxxxxxxxxxxx [mailto:gptalk-bounce@xxxxxxxxxxxxx] On
Behalf Of Darren Mar-Elia
Sent: 11. februar 2008 01:21
To: gptalk@xxxxxxxxxxxxx
Subject: [gptalk] Re: I Need The Perfect Desktop WMI Filter

 

Yes, I can understand the problem. You want desktops to return True all the
time instead of having them return false. One idea that might be worth
exploring is querying Win32_SystemSlot. My expectation is that laptops
should have 0 system slots or at least no more than 1, though I don't have
one to test now, and that desktops should have > 0. So that might be worth
exploring. 

 

Darren

 

From: gptalk-bounce@xxxxxxxxxxxxx [mailto:gptalk-bounce@xxxxxxxxxxxxx] On
Behalf Of Jakob H. Heidelberg
Sent: Sunday, February 10, 2008 12:02 PM
To: gptalk@xxxxxxxxxxxxx
Subject: [gptalk] Re: I Need The Perfect Desktop WMI Filter

 

Hi Darren,

 

I have to turn it around somehow - have been there (just selecting the
class) - the thing is the query will return FALSE on a desktop (have tested
with you WMI TEST tool too). So, a desktop will not load the GPO.

 

Select * from Win32_Battery is OK for spotting a laptop though. But, I'm
basically looking for something like:

 

 

A) Select * from Win32_SomeClassOnlyDesktopsHave

 

Or

 

B )Select * from Win32_SomeClass.SomeValue = "SomeValueOnlyDesktopsHave"

 

Or

 

C) Some way of saying "if you don't know the class (eg. Battery), apply the
GPO anyway" (Brainstorm: On Error, NULL return etc. - just not possible with
WQL).

 

 

The "quest" is to find the perfect, *universal*, way of spotting
"Non-laptops" or Desktops - it can be done by looking for some special
computer Manufacturer, computer Model, BIOS version or whatever - but that's
different from environment to environment.

 

 

Any ideas?

 

 

Regards & thanks

/Jakob

 

From: gptalk-bounce@xxxxxxxxxxxxx [mailto:gptalk-bounce@xxxxxxxxxxxxx] On
Behalf Of Darren Mar-Elia
Sent: 10. februar 2008 20:34
To: gptalk@xxxxxxxxxxxxx
Subject: [gptalk] Re: I Need The Perfect Desktop WMI Filter

 

Jakob-

I think you were close when you were using Win32_Battery. That is the one
thing that you can reliably say that laptops have, but desktops don't. So,
have you tried the following:

 

Select * from Win32_Battery

 

Just that. Nothing else. What that does is determine if there are any
instances of that class. If not (i.e., on a desktop machine) it returns
false. If so, on a laptop, it returns true. 

 

Waddya think?

 

Darren

 

From: gptalk-bounce@xxxxxxxxxxxxx [mailto:gptalk-bounce@xxxxxxxxxxxxx] On
Behalf Of Jakob H. Heidelberg
Sent: Sunday, February 10, 2008 8:36 AM
To: gptalk@xxxxxxxxxxxxx
Subject: [gptalk] I Need The Perfect Desktop WMI Filter

 

Hi all,

 

I'm in desperate need of *the perfect WMI filter for spotting DESKTOP
computers only* - have been thinking about this for some days now.

 

I've been around solutions looking for ChassisType before - which basically
doesn't work because that's an Array. Have tried PowerSupplyState,
DesktopMonitor, DisplayConfiguration and others - just haven't found the
perfect "this is definitely a desktop WMI value"...

 

I've also been around using Battery/PortableBattery
/PCMCIAController/POTSModem - which all work fine to spot LAPTOPS...
However, desktops don't know the CLASS at all, so they return FALSE no
matter what. I can't even say things like "Select * From Win32_Battery Where
Availability != 2" or "Where Not X Like Y" or whatever - a desktop doesn't
handle the Win32_Battery class at all, so it's gonna say "Heck, I don't know
anything about that class *Panic* - I'm out!" - or just "False" J.

 

The thing is, that normally it's the LAPTOPS that have special hardware -
like Batteries and built-in Modems, PCMCIA slots etc. - so they are pretty
easy to find. With desktop computers it's another story for my part - hope
you can help me out here.

 

Please - I know lot's of "workarounds", but what I need is a *WMI filter*
and it has to return *TRUE* for *DESKTOPS* (or let's call the NON-LAPTOPS,
it doesn't matter). Also, if the customer had used computer names like
"DESKxxx" for desktops and "LAPTxxx" for laptops, I know I could have used
WMI filters for computer name - but unfortunately that's not the case. You
could say I'm looking for a global solution for spotting DESKTOPS using WMI
filter - I know lots of cases where this could come in handy.

 

 

Hope to hear from you soon! J

 

 

Best regards
Jakob H. Heidelberg

 

Other related posts: