Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / Languages / C#

Checking Windows architecture using WMI

4.00/5 (1 vote)
18 Sep 2010CPOL 8.7K  
Check if windows is 64 or 32 bit using WMI
This code snippet requires reference to System.Management DLL:

C#
var obj = new ManagementObjectSearcher("Select * FROM Win32_OperatingSystem");
var col = obj.Get();
foreach (var mgn in col)
     {
     string arch = mgn["OSArchitecture"].ToString();
     return arch.Contains("64");
     }
return false;

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)