Topic
14 replies Latest Post - ‏2010-12-16T18:41:15Z by gjeremia91
SystemAdmin
SystemAdmin
757 Posts
ACCEPTED ANSWER

Pinned topic Is Laptop?

‏2009-05-04T17:44:27Z |
We have a global property established to determine if a device is a laptop.

if (exists wmi) then ((exists selects "* from win32_Battery" of wmi) as string) else ("N/A")

The issue is that this query returns false positives for some devices that have UPS attached.

Does anyone have a more accurate version of this property? Maybe something that considers the battery vendor?
Updated on 2010-12-16T18:41:15Z at 2010-12-16T18:41:15Z by gjeremia91
  • SystemAdmin
    SystemAdmin
    757 Posts
    ACCEPTED ANSWER

    Re: Is Laptop?

    ‏2009-05-04T19:17:15Z  in response to SystemAdmin
    I believe the following may also work but am not sure how a UPS would affect the results.

    if (exists wmi) then ((exists selects "* from win32_Battery" 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")
  • drp91
    drp91
    1 Post
    ACCEPTED ANSWER

    Re: Is Laptop?

    ‏2009-05-29T14:53:08Z  in response to SystemAdmin
    Several of us here just went through this exercise and found a reliable way to detect for Windows laptops/notebooks using just a BES inspector:

    exists descriptions whose (it as string as lowercase = "Microsoft ACPI-Compliant Control Method Battery" as lowercase) of active devices

    We've only been running this for 24 hrs...but so far so good and we haven't seen any exceptions..we've verified it for devices in our environment with UPS and none of these are reporting false positives.

    We're using the same inspector to detect for devices with UPS battery:

    exists descriptions whose (it as string as lowercase contains "HID UPS Battery" as lowercase) of active devices

    So far, this is also reliable in our Windows environment...
  • SystemAdmin
    SystemAdmin
    757 Posts
    ACCEPTED ANSWER

    Re: Is Laptop?

    ‏2009-06-03T14:43:06Z  in response to SystemAdmin
    Thanks. I'll give that a try.
  • SystemAdmin
    SystemAdmin
    757 Posts
    ACCEPTED ANSWER

    Re: Is Laptop?

    ‏2009-07-30T17:13:36Z  in response to SystemAdmin
    I just ran this through the relevance inspector and it took quite a long time to evaluate compared to the ((exists selects "* from win32_Battery" of wmi) as string) logic. But it does seem to be quite a bit more accurate at finding laptops.

    I also found that in the "Hardware Information - Windows" Analysis BigFix is setting a property called "Laptop - Windows" using this logic:

    if (exists wmi) then ((exists selects "* from win32_Battery" 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")

    It seems to be accurate and fast.

    Can one use a property in relevance?
    Updated on 2009-07-30T17:13:36Z at 2009-07-30T17:13:36Z by SystemAdmin
  • MattBoyd
    MattBoyd
    63 Posts
    ACCEPTED ANSWER

    Re: Is Laptop?

    ‏2009-07-31T14:56:18Z  in response to SystemAdmin
    jspanitz
    Can one use a property in relevance?
    I would also be interested to know if or how this can be done. I've been able to lookup client properties with something like:

    value of setting "<client property>" of client

    However, the relevance above does not work for the "Laptop - Windows" property. Is there anyway to use a property such as "Laptop - Windows" with relevance similar to this?
  • SystemAdmin
    SystemAdmin
    757 Posts
    ACCEPTED ANSWER

    Re: Is Laptop?

    ‏2010-03-19T21:08:08Z  in response to SystemAdmin
    I’m getting into a bit of a pickle.
    I wrote a fixlet to install Retrospect 7.7 (custom MSI) using relevance language as follows …

    ((Name of Operating System as lowercase starts with "win") AND (not exists Service "Retrospect Client") AND (exists wmi) AND (exists selects "* from win32_Battery" of wmi) AND (NOT (Computer Name as lowercase starts with "my-pc-")) OR (Computer Name as lowercase = "Test-PC")) ("my-pc-" is part of a naming convention of some PC's I want to avoid)

    I then began to get reports from users that their desktop computers were reporting that Retrospect was installed and that they had not been backed up. This is not what I intended. I wanted this to ONLY go to LAPTOP computers, hence the code from the Batteries Property.

    In looking into it, I found that if a Desktop computer has a UPS connected to it, it will report that it has a battery installed. Yikes.

    I wrote a Property retriever as follows . . .
    (exists wmi) AND (exists selects "* from win32_Battery" of wmi) AND (NOT exists string value whose (it as lowercase contains "ups") of selects "Name from win32_Battery" of wmi)

    Can you recommend a better Relevance clause to detect “laptops” and not “Desktops with UPS’s”?
  • BenKus
    BenKus
    480 Posts
    ACCEPTED ANSWER

    Re: Is Laptop?

    ‏2010-03-19T22:05:03Z  in response to SystemAdmin
    You guys have UPSs on your desktops now? Sigh... :)

    I like your relevance... do you find it works well in practice?

    Ben
  • NoahSalzman
    NoahSalzman
    102 Posts
    ACCEPTED ANSWER

    Re: Is Laptop?

    ‏2010-03-19T22:29:26Z  in response to SystemAdmin
    chassis == laptop ... from further up in the thread

    if (exists wmi) then ((exists selects "* from win32_Battery" of wmi AND exists string value whose (it as lowercase contains "laptop") of selects "ChassisTypes from Win32_SystemEnclosure" of wmi ) as string) else ("N/A")
    Edit: changed OR to AND
    Updated on 2010-03-19T22:29:26Z at 2010-03-19T22:29:26Z by NoahSalzman
  • DennisA91
    DennisA91
    1 Post
    ACCEPTED ANSWER

    Re: Is Laptop?

    ‏2010-03-23T15:44:32Z  in response to SystemAdmin
    We've abandoned the WMI approach entirely because, as cited in posts above, it has returned numerous false positives from desktops. The distinction between Laptops and Desktops is getting blurrier every day..:o, and the requirements for determining Laptops may vary substantially from network to network. I would recommend engaging your users so that you can get a representative sampling of what machines to expect on your network.

    That said, using the idea in this thread above from drp, I've had the following Analysis property running for a couple of months with spot-on accuracy (ON OUR NETWORK!) in determining if a machine is a laptop:

    IF (exists descriptions whose (it contains "Microsoft ACPI-Compliant Control Method Battery") of active devices) then "Laptop" ELSE "Not Laptop"
  • BenKus
    BenKus
    480 Posts
    ACCEPTED ANSWER

    Re: Is Laptop?

    ‏2010-03-24T03:21:20Z  in response to SystemAdmin
    Thanks guys for sharing your properties and info... Looks like it is time to update our property... This is helpful because it coincides with our upcoming power management release...

    I updated our "System Type" property with a bunch of changes... can you guys give some feedback on this?

    if name of operating system contains "Mac OS" then( if ((exists key whose (it as string as lowercase contains "battery") of entries of dictionaries of nodes of it) or (exists node "AppleACPIPlatformExpert/SMB0/AppleECSMBusController/AppleSmartBatteryManager" of service plane of iokit registry) of it) of service plane of iokit registry then "Laptop" else "Workstation" ) else if (name of operating system contains "Linux" OR name of operating system contains "Unix" ) then "Server" else 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 "Server" else if (exists wmi AND exists string value whose (it as lowercase does not contain "ups") of selects "name from win32_Battery" of wmi) then "Laptop" else "Workstation") else "Unknown"

    Thanks!
    Ben
  • kespoor91
    kespoor91
    2 Posts
    ACCEPTED ANSWER

    Re: Is Laptop?

    ‏2010-08-24T18:00:11Z  in response to SystemAdmin
    Ben-
    I'm no where near a code-guru, but I'm curious why, for the section identifying specifically the windows laptops, you're not using the same basic checks as for the Laptop-Windows property found on the Hardware Information (Windows) Analysis.

    if (exists wmi) then (((exists selects "* from win32_Battery" of wmi) and (exists descriptions whose (it as string as lowercase = "Microsoft ACPI-Compliant Control Method Battery" as lowercase) of active devices)) OR exists (( (8; 9; 10; 11; 12; 14; 18; 21), (integer values of selects "ChassisTypes from Win32_SystemEnclosure" of wmi) ) whose (item 0 of it = item 1 of it))) as string else ("N/A")

    vs

    ... if (exists wmi AND exists string value whose (it as lowercase does not contain "ups") of selects "name from win32_Battery" of wmi) then "Laptop" ...
    Besides just the length/complexity issue... is there a particular reason to look for the 'does not contain "ups"' vs looking at the chassis type? Is it maybe to reduce the total number of calls to wmi? I'm just wanting to understand why one would be preferred over the other, and in what kind of circumstances.

    Thanks!
  • BenKus
    BenKus
    480 Posts
    ACCEPTED ANSWER

    Re: Is Laptop?

    ‏2010-08-24T22:54:07Z  in response to SystemAdmin
    Hi kespoor,

    I think the key issue is that the hardware itself doesn't necessarily know it is a laptop by any authoritative method... so you have to come up with tricks that work in certain situations...

    The "if exists battery then laptop" method that we have been using for years has worked pretty well, but as other people point out, sometimes their servers or desktops have a batter too... So we started to try to look at ways of filtering those out (like detecting if the battery is UPS).

    The chassis detection method that the relevance in the Hardware Information analysis seems useful, but in practice, many hardware manufactures don't properly put in the laptop chassis type, so it is only helpful in certain cases... Note also that an ACPI compliant batter on a desktop will still trigger BigFix to think it is a laptop in this property...

    Ben
  • SystemAdmin
    SystemAdmin
    757 Posts
    ACCEPTED ANSWER

    Re: Is Laptop?

    ‏2010-10-27T14:50:23Z  in response to SystemAdmin
    Ran this and found a bunch of unknowns... upon investigation found several server OS's that were not accounted for: AIX, HP-UX, SunOS
    So i modified the relevance:

    if name of operating system contains "Mac OS" then (if ((exists key whose (it as string as lowercase contains "battery") of entries of dictionaries of nodes of it) or (exists node "AppleACPIPlatformExpert/SMB0/AppleECSMBusController/AppleSmartBatteryManager" of service plane of iokit registry) of it) of service plane of iokit registry then "Laptop" else "Workstation") else if (name of operating system contains "Linux" OR name of operating system contains "Unix" OR name of operating system contains "AIX" OR name of operating system contains "HP-UX" OR name of operating system contains "SunOS") then "Server" else 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 "Server" else if (exists wmi AND exists string value whose (it as lowercase does not contain "ups") of selects "name from win32_Battery" of wmi) then "Laptop" else "Workstation") else "Unknown"
  • gjeremia91
    gjeremia91
    23 Posts
    ACCEPTED ANSWER

    Re: Is Laptop?

    ‏2010-12-16T18:41:15Z  in response to SystemAdmin
    I am not a fan that we automatically consider Linux to be a "Server". I'm using Linux as workstation and we have thousands of them in our organization. That and of course the MAC is just a pretty Linux/bsd box (lol...I use MAC too so don't hate).

    Secondly, I feel the need to change "Workstation" to "Desktop". The most common definition I see has Workstation as a super class of Laptop and Desktop.

    For us, we can check a value in a file to determine if we have a Linux server or Linux workstation, but for the general approach below I have only included "Laptop" or "Server" for Linux":

    color=blue
    if name of operating system as lowercase starts with "mac os"
    then( if ((exists key whose (it as string as lowercase contains "battery") of entries of dictionaries of nodes of it) or (exists node "AppleACPIPlatformExpert/SMB0/AppleECSMBusController/AppleSmartBatteryManager" of service plane of iokit registry) of it) of service plane of iokit registry then "Laptop" else "Desktop" ) else

    if (name of operating system contains "Linux") then
    (if exists folders "/proc/acpi/battery" whose (exists files of it) and exists folders "/proc/acpi/ac_adapter" whose (exists files of it) then "Laptop" else [/color]color=red"Server"[/color]color=blue) else

    if ((name of it contains "Unix" OR name of it contains "AIX" OR name of it contains "HP-UX" OR name of it contains "SunOS") of operating system ) then "Server" else

    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 "Desktop" else if (value "ProductType" of key "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ProductOptions" of registry != "WinNT") then "Server" else if (exists wmi AND exists string value whose (it as lowercase does not contain "ups") of selects "name from win32_Battery" of wmi) then "Laptop" else "Desktop")

    else "Unknown"
    [/color]

    In the red section is where we include our test for Linux Desktop vs Linux Server (if Laptop, always Laptop, never Server)
    Updated on 2010-12-16T18:41:15Z at 2010-12-16T18:41:15Z by gjeremia91