C++ How to detect if a system is a PC, Laptop or Server

Posted on 2009-02-13
Last Modified: 2013-12-14
I'm writing a program which needs to know whether a system is a desktop PC, laptop or a server.  It does not have to be 100% but needs to be pretty accurate.  I can check for a server simply by looking at the OS so that's not a problem.  A laptop I thought I could detect using the GetSystemPowerStatus() call but looking on the Internet it seems this may be flaky.  Any suggestions how best to determine what type of computer the program is running on.  This needs to be standrad MFC code as I can't guarantee that .NET will be installed
Question by:ChrisMDrew
    LVL 12

    Accepted Solution

    Look at the registry key HKEY_LOCAL_MACHINE\System\CurrentControl\Control\ProductionOptions, value ProductType
    "WinNT" = Windows desktop OS (XP, Vista, etc)
    "ServerNT" = Windows server OS (non-domain controller)
    "LanmanNT" = Windows server OS (domain controller)
    This works on all versions of Windows back to Windows NT.

    There is no reliable way to detect a laptop AFAIK.  Many 'desktop replacement' laptops (like the Dell XMP) look just like desktops.  And many desktops have aggressive power-saving modes that look like laptops.

    Author Closing Comment

    Used part of this and also my own code which although not 100% does detect most laptops I have tested

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Enabling OSINT in Activity Based Intelligence

    Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

    Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
    How to install Selenium IDE and loops for quick automated testing. Get Selenium IDE from ( Go to that link and select download selenium in the right hand columnThat will then direct you to their downlo…
    THe viewer will learn how to use NetBeans IDE 8.0 for Windows to perform CRUD operations on a MySql database.
    This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now