如何获取计算机的systeminfo。
系统制造商:
系统模型:
Bios版本:
答案 0 :(得分:7)
您可以使用以下内容获取制造商名称,添加对System.Management
的引用。
System.Management.SelectQuery query = new System.Management.SelectQuery(@"Select * from Win32_ComputerSystem");
//initialize the searcher with the query it is supposed to execute
using (System.Management.ManagementObjectSearcher searcher = new System.Management.ManagementObjectSearcher(query))
{
//execute the query
foreach (System.Management.ManagementObject process in searcher.Get())
{
//print system info
process.Get();
Console.WriteLine("/*********Operating System Information ***************/");
Console.WriteLine("{0}{1}", "System Manufacturer:", process["Manufacturer"]);
Console.WriteLine("{0}{1}", " System Model:", process["Model"]);
}
}
System.Management.ManagementObjectSearcher searcher1 = new System.Management.ManagementObjectSearcher("SELECT * FROM Win32_BIOS");
System.Management.ManagementObjectCollection collection = searcher1.Get();
foreach (ManagementObject obj in collection)
{
if ( ((string[])obj["BIOSVersion"]).Length > 1)
Console.WriteLine("BIOS VERSION: " + ((string[])obj["BIOSVersion"])[0] + " - " + ((string[])obj["BIOSVersion"])[1]);
else
Console.WriteLine("BIOS VERSION: " + ((string[])obj["BIOSVersion"])[0]);
}
答案 1 :(得分:1)
您可以使用以下类
已由其他人完成,如果您进行了快速谷歌搜索,则很容易找到
http://www.codeproject.com/Articles/362227/System-Information
答案 2 :(得分:0)
您可以查看此网站并获取创建程序所需的所有信息:
http://www.csharpdeveloping.net/Snippet/how_to_get_bios_info
当然,我不会构建哪种程序,所以我只提供如何检索数据。