需引用System.Management命名空间,

具体代码如下:

 public class SysProp
{
public SysProp()
{ ManagementObjectSearcher PhysicalMemory = new ManagementObjectSearcher("select * from Win32_PhysicalMemory");
ManagementObjectSearcher Processor = new ManagementObjectSearcher("select * from Win32_Processor");
ManagementObjectSearcher Os = new ManagementObjectSearcher("select * from Win32_OperatingSystem");
ManagementObjectSearcher VideoController = new ManagementObjectSearcher("select * from Win32_VideoController");
ManagementObjectSearcher CompSys = new ManagementObjectSearcher("select * from Win32_ComputerSystem"); PhysicalMemory_Capacity = String.Format("{0} MB", Convert.ToInt64(GetValue(PhysicalMemory, "Capacity")) / / ); ProcessorName = (string)GetValue(Processor, "Name"); OperatingSystemBit = System.Environment.Is64BitOperatingSystem ? "64位" : "32位";
Os_Caption = (string)GetValue(Os, "Caption");
Os_Version = System.Environment.OSVersion.Version.ToString();
ServicePack = !String.IsNullOrEmpty(System.Environment.OSVersion.ServicePack)
? System.Environment.OSVersion.ServicePack
: "无";
SystemSpecialFolder = System.Environment.GetFolderPath(System.Environment.SpecialFolder.System);
Video_Caption = (string)GetValue(VideoController, "Caption");
UserName = System.Environment.UserName;
UserDomainName = System.Environment.UserDomainName;
CompSys_Workgroup = (string)GetValue(CompSys, "Workgroup");
} private object GetValue(ManagementObjectSearcher searcher, string propName)
{
foreach (ManagementObject mobj in searcher.Get())
return mobj[propName];
throw new NotSupportedException();
} /// <summary>
/// 物理内存
/// </summary>
public string PhysicalMemory_Capacity { get; set; } /// <summary>
/// 处理器
/// </summary>
public string ProcessorName { get; set; } /// <summary>
/// 处理器架构
/// </summary>
public string OperatingSystemBit { get; set; } /// <summary>
/// window名称
/// </summary>
public string Os_Caption { get; set; } /// <summary>
/// window版本
/// </summary>
public string Os_Version { get; set; } /// <summary>
///
/// </summary>
public string ServicePack { get; set; } /// <summary>
/// 系统目录
/// </summary>
public string SystemSpecialFolder { get; set; } /// <summary>
/// 显卡名称
/// </summary>
public string Video_Caption { get; set; } /// <summary>
/// 用户名
/// </summary>
public string UserName { get; set; } /// <summary>
/// 计算机名称
/// </summary>
public string UserDomainName { get; set; } /// <summary>
/// 工作组
/// </summary>
public string CompSys_Workgroup { get; set; }
}

C#获取WINDOWS系统信息的更多相关文章

  1. 几个获取Windows系统信息的Delphi程序

    1.获取windows版本信息 可以通过Windows API函数GetVersionEx来获得. 具体程序如下: Procedure Tform1.Button1Click(sender:TObje ...

  2. Python WMI获取Windows系统信息 监控系统

    #!/usr/bin/env python # -*- coding: utf-8 -*- #http://www.cnblogs.com/liu-ke/ import wmi import os i ...

  3. 获取windows系统信息

    在应用程序中,有时需要在界面中显示计算机的硬件信息和进程信息.在.Net中提供了可以查询信息的类.Management类,在程序中添加应用后进行使用. 1 属性 类似的属性介绍可见下面: 属性介绍 根 ...

  4. Python WMI获取Windows系统信息

    #!/usr/bin/env python # -*- coding: utf-8 -*- #http://www.cnblogs.com/liu-ke/ import wmi import os i ...

  5. python使用wmi模块获取windows下的系统信息监控系统-乾颐堂

    Python用WMI模块获取Windows系统的硬件信息:硬盘分区.使用情况,内存大小,CPU型号,当前运行的进程,自启动程序及位置,系统的版本等信息. 本文实例讲述了python使用wmi模块获取w ...

  6. 获取windows 操作系统下的硬件或操作系统信息等

    奇怪的工作,制作的是一款办公应用软件,领导却要求我统计用户计算机的物理信息,什么CPU的型号.核心数,什么内存信息等各种乱七八糟的用户信息.我想问,现在用户的信息就这么没有隐私性了么?想获取就获取传递 ...

  7. 使用C#获取Windows Phone手机的各种数据(转)

    转自:http://www.sum16.com/desinger/use-c-sharp-get-windows-phone-information.html 使用C#获取Windows Phone手 ...

  8. PHP】获取客户端(浏览器)信息、获取客户端系统信息、获取服务器信息

    * 获取客户端浏览器信息 * @param null * @author https://blog.jjonline.cn/phptech/168.html * @return string */ f ...

  9. 通过PowerShell获取Windows系统密码Hash

    当你拿到了系统控制权之后如何才能更长的时间内控制已经拿到这台机器呢?作为白帽子,已经在对手防线上撕开一个口子,如果你需要进一步扩大战果,你首先需要做的就是潜伏下来,收集更多的信息便于你判断,便于有更大 ...

随机推荐

  1. 消息队列mq总结(重点看,比较了主流消息队列框架)

    转自:http://blog.csdn.net/konglongaa/article/details/52208273 http://blog.csdn.net/oMaverick1/article/ ...

  2. TP中登录验证

    loginpro 1.建立控制器 loginController.calss.php <?php namespace Admin\Controller; header('Content-type ...

  3. Python函数-map()

    map()函数 map()是 Python 内置的高阶函数,它接收一个函数 f 和一个 list,并通过把函数 f 依次作用在 list 的每个元素上,得到一个新的 list 并返回.如下: def ...

  4. poj 2096 , zoj 3329 , hdu 4035 —— 期望DP

    题目:http://poj.org/problem?id=2096 题目好长...意思就是每次出现 x 和 y,问期望几次 x 集齐 n 种,y 集齐 s 种: 所以设 f[i][j] 表示已经有几种 ...

  5. python sentence

    1.while for 增加了循环正常结束后执行的else代码块. 2.Objects are mutable 3.import copy p1 = Point() p2=copy.copy(p1) ...

  6. 三层自动生成 完整源代码(for oracle)

    using Oracle.DataAccess.Client; using System; using System.Collections.Generic; using System.Compone ...

  7. [转载]Sleep(x)的使用和sleep(0)作用解析

    链接:http://blog.csdn.net/m_leonwang/article/details/28434383 假设现在是 2012-12-16 3:37:40,如果我调用一下 Thread. ...

  8. php用zendstudio建立wsdl

    首先,新建的时候要选择soap,然后deocument和rpc都可以. 类和方法的页面: <?php //发货接口 class test{ function send_do_delivery($ ...

  9. [转] LINUX 三种网络连接模式

     Linux下NAT模式和桥接模式的网络配置 最近在配置linux虚拟机的时候发现有很多坑,现在记录下来以防日后又跳到坑里. 我的运行环境是:主机 windows 7  虚拟机 Virtualbox ...

  10. mysql高可用集群——MHA架构

    目录1.下载2.搭建mha 2.1 系统配置 2.2 架构 2.3 添加ssh公钥信任 2.4 安装mha节点 2.5 manager配置文件 2.6 检查 2.7 启动manager进程 2.8 碰 ...