Click here to Skip to main content
15,894,540 members
Articles / Programming Languages / C#
Tip/Trick

Checking Windows architecture using WMI

Rate me:
Please Sign up or sign in to vote.
4.00/5 (1 vote)
18 Sep 2010CPOL 8.7K   1  
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)


Written By
Software Developer ABB
Poland Poland
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
-- There are no messages in this forum --