Relevance Statement for laptop detection

(imported topic written by SystemAdmin)

I want to find all laptops and then check for the existence of a key.

My plan is to create a custom Analyses and find all laptops using a relevance query and then have a properties query to check for the existance of the required registry key. The registry key part is fine it’s just the relevance part that I’m having a problem with.

I already have a previous Analyses that I’ve created that works great :

(if it contains “{1}” then “Other” else if it contains “{2}” then “Unknown” else if it contains “{3}” then “Desktop” else if it contains “{4}” then “Low Profile Desktop” else if it contains “{5}” then “Pizza Box” else if it contains “{6}” then “Mini Tower” else if it contains “{7}” then “Tower” else if it contains “{8}” then “Portable” else if it contains “{9}” then “Laptop” else if it contains “{10}” then “Notebook” else if it contains “{11}” then “Handheld” else if it contains “{12}” then “Docking Station” else if it contains “{13}” then “All-in-One” else if it contains “{14}” then “Sub-Notebook” else if it contains “{15}” then “Space Saving” else if it contains “{16}” then “Lunch Box” else if it contains “{17}” then “Main System Chassis” else if it contains “{18}” then “Expansion Chassis” else if it contains “{19}” then “Sub-Chassis” else if it contains “{20}” then “Bus Expansion Chassis” else if it contains “{21}” then “Peripheral Chassis” else if it contains “{22}” then “Storage Chassis” else if it contains “{23}” then “Rack Mount Chassis” else if it contains “{24}” then “Sealed-Case PC” else “Unknown”) of ((select objects (“ChassisTypes from Win32_SystemEnclosure”) of wmi as string))

However when I do the following as a relevance query:

( (it contains “{8}”) of (select objects (“ChassisTypes from Win32_SystemEnclosure”) of wmi as string) )

it doesn’t match any Laptops, though from the above statement I know they exist.

What am I doing wrong? Is this the best way to actually do it in the first place? Is there a better way to detect Laptops?

Thanks for your help.

(imported comment written by BenKus)

Your relevance works on my laptop computer… I get:

q: (if it contains “{1}” then “Other” else if it contains “{2}” then “Unknown” else if it contains “{3}” then “Desktop” else if it contains “{4}” then “Low Profile Desktop” else if it contains “{5}” then “Pizza Box” else if it contains “{6}” then “Mini Tower” else if it contains “{7}” then “Tower” else if it contains “{8}” then “Portable” else if it contains “{9}” then “Laptop” else if it contains “{10}” then “Notebook” else if it contains “{11}” then “Handheld” else if it contains “{12}” then “Docking Station” else if it contains “{13}” then “All-in-One” else if it contains “{14}” then “Sub-Notebook” else if it contains “{15}” then “Space Saving” else if it contains “{16}” then “Lunch Box” else if it contains “{17}” then “Main System Chassis” else if it contains “{18}” then “Expansion Chassis” else if it contains “{19}” then “Sub-Chassis” else if it contains “{20}” then “Bus Expansion Chassis” else if it contains “{21}” then “Peripheral Chassis” else if it contains “{22}” then “Storage Chassis” else if it contains “{23}” then “Rack Mount Chassis” else if it contains “{24}” then “Sealed-Case PC” else “Unknown”) of ((select objects (“ChassisTypes from Win32_SystemEnclosure”) of wmi as string))
A: Portable
A: Docking Station

But I am not sure if the computer manufacturers always fill in this “ChassisTypes” value appropriately… The method that BigFix uses to detect the presence of a laptop is to look for a battery:

(exists wmi AND exists selects “* from win32_Battery” of wmi)

This method has worked well with us over the years…

Ben

(imported comment written by rkc91)

crap1

you can try pcmica

if value “Start” of key “HKLM\System\CurrentControlSet\Services\Pcmcia” of registry as string =“0” then “Laptop” else “Not Laptop”

rkc

(imported comment written by dave_dunn91)

This works:

if (exists wmi) then ((exists selects “* from win32_PCMCIAController” of wmi OR exists string value whose (it as lowercase contains “laptop”) of selects “ChassisTypes from Win32_SystemEnclosure” of wmi ) as string) else (“N/A”)

(imported comment written by SystemAdmin)

Thanks to all. I went with Ben Kus in the end. By the way we have around 1500 machines and my original query works well on around 98% of the machines (we are dell here with very few exceptions).

(imported comment written by jr6591)

In using this, (exists wmi AND exists selects “* from win32_Battery” of wmi) we did in fact get 31 Servers that for some reason meet this criteria. And yes, they are not in fact laptops!

I’m trying to figure out an analysis that will apply to either laptops or tablets with an certain regapp. What I am looking for is "is it a laptop or a tablet OR does it have a regapp

This is what I ahve

((exists wmi AND exists selects “* from win32_Battery” of wmi) OR exists regapp “Extranet.exe”)

But, will this cover tablets and why are 31 Servers showing up???

I was trying to use this:

if (name of operating system as lowercase starts with “win”) then (if (name of operating system = “Win95” OR name of operating system = “Win98” or name of operating system = “WinME”) then “Workstation” else (if (value “ProductType” of key “HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ProductOptions” of registry = “WinNT”) then “Workstation” else “Server”)) else "Unknown - " & name of operating system

But, i couldn’t figure out to apply it in a relevance to become true only if its a Workstation.

(imported comment written by SystemAdmin)

If you check strictly by checking for a battery, you will have machines detected that have ups attached, this will include servers and workstation OS Type.

You could try adding relevancy to exclude Server OS Types. I am unsure what chassis type a Tablet is.

This is what I use in our environment. We have a Environment variable “Type” that gets set up during our imaging process, we use that variable if its available. I only classify 9, 10, and 14 as Laptops, returning the other chassis codes if available.

IF (name of operating system as lowercase starts with “win”) THEN (IF (name of operating system = “Win95” OR name of operating system = “Win98” or name of operating system = “WinME”) OR (exists key “HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ProductOptions” whose (value “ProductType” of it = “WinNT”) of registry) THEN (If (exists variable “TYPE” whose (exists value whose (it as string as lowercase = “laptop”) of it) of environment) then “Laptop - Image” else If (exists variable “TYPE” whose (exists value whose (it as string as lowercase = “tablet”) of it) of environment) THEN (“Tablet - Image”) else (IF ((exists wmi) AND (exists selects “ChassisTypes from Win32_SystemEnclosure” whose (integer value of it = 10 OR integer value of it = 9 OR integer value of it = 14) of wmi)) Then ("Laptop - WMI - " & (IF (exists selects “ChassisTypes from Win32_SystemEnclosure” whose (integer value of it = 10 ) of wmi) then (“Notebook”) else IF (exists selects “ChassisTypes from Win32_SystemEnclosure” whose (integer value of it = 9 ) of wmi) then (“Laptop”) else (“Sub Notebook”))) else (IF ((exists wmi) AND (exists selects “ChassisTypes from Win32_SystemEnclosure” whose (exists integer value of it) of wmi)) THEN ("Unkown - WMI - " & (concatenation “:” of (integer values of selects “ChassisTypes from Win32_SystemEnclosure” of wmi as string))) ELSE (IF (exists wmi) AND (exists selects “* from win32_Battery” of wmi) THEN (“Unkown - WMI - Battery”) ELSE (“Unknown”))))) ELSE (“N/A-Non Workstation”)) ELSE (“N/A-Non Windows”)

(imported comment written by JoeW91)

I was having issues where we had about 1,400 machines that were returning on the System Type check. The problem ended up being using WMI to check for a battery so we could identify the laptops. I did some digging and came up with this non-WMI battery check:

if (exists (it as string as lowercase = “cmbatt_inst”) of values whose (name of it as lowercase contains “infsection”) of (it;keys of it; keys of keys of it; keys of keys of keys of it) of key “HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class{72631E54-78A4-11D0-BCF7-00AA00B7B32A}” of registry) then “Laptop” else “Workstation”

Using this I went from 1,400 to 3. And it’s nice to have eliminated WMI from one more thing.