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

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
ChrisMDrewAsked:
Who is Participating?
 
Gideon7Connect With a Mentor Commented:
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.
0
 
ChrisMDrewAuthor Commented:
Used part of this and also my own code which although not 100% does detect most laptops I have tested
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.