Get Device Info using C# in Windows Universal App (Windows 10)

Lincoln Quick picture Lincoln Quick · May 26, 2015 · Viewed 10.7k times · Source

I was wondering how to get device-specific information programmatically using C# in the new Universal Windows app platform. This is to get a simplistic PC Toolbox I have from existing C# code for an old Windows Form project onto the UAP in Windows 10.

I'm looking to get total RAM installed (or available), CPU Architecture and ID/Name (such as 64-bit Intel Core i5-XXXX), Device manufacturer and model number (Dell XPS XXXX), and serial number/service tag.

It's a given that these apps will be using Windows 10 and this app will initially be geared for traditional PCs, but I'd like to expand to Windows Phone/Mobile with limited capabilities (not sure how/if some parts will work on ARM). How would I detect which edition of Windows 10, such as "Home", "Pro", "Enterprise", "Mobile", or "Mobile Enterprise", as well as 32/64 bit, and Language?

I have existing C# code that used a library that doesn't seem to work with Windows Store apps.

I'm pretty rusty with C#, but any help to any classes or references would be greatly appreciated. I realize that getting all the code to store all of these specifications may be a little much (if even possible ATM), but a pointer in the right direction would be very helpful.

Answer

Rami Sarieddine picture Rami Sarieddine · Dec 6, 2015

You can tap into AnalyticsInfo and AnalyticsVersionInfo to get the information, as noted on the documentation page (https://msdn.microsoft.com/en-us/library/windows/apps/windows.system.profile.analyticsinfo.aspx)

If you want to get the HardwareIdentification information however you will need to look somewhere else as it is not part of the Universal Device Family, it's part of the Desktop and Mobile family (device family specific).

To get this type of device-speficic info available, you have to add the references to the device specific extensions.

Anyways, The APIs that were used to gather these data have changed from 8.x to UWP. I have found one blog post <https://www.suchan.cz/2015/08/uwp-quick-tip-getting-device-os-and-app-info/> for someone who has created a helper class that retrieves the following properties for example from a Windows 10 UWP app

current OS family - phone/desktop/...

current OS build number - 10.0.10240.16413

current OS architecture - x86/x64/ARM

current App Display Name

current App Version - 3.0.2.0

current Device manufacturer - Nokia

current Device model - Lumia 1520

In his post he shows how to get basic data about current device, operating system and application. hope it helps!