Chinaunix首页 | 论坛 | 博客
  • 博客访问: 8302
  • 博文数量: 11
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 240
  • 用 户 组: 普通用户
  • 注册时间: 2013-03-11 10:17
文章分类
文章存档

2015年(3)

2014年(5)

2013年(3)

我的朋友
最近访客

分类: IT职场

2015-01-13 04:29:47



      function getSysInfo() {
          var locator = new ActiveXObject("WbemScripting.SWbemLocator");
          var service = locator.ConnectServer(".");
          //CPU疑息
          var cpu = new Enumerator(service.ExecQuery("SELECT * FROM Win32_Processor")).item();
          var cpuType = cpu.Name, hostName = cpu.SystemName;
             //内存疑息
             var memory = new Enumerator(service.ExecQuery("SELECT * FROM Win32_PhysicalMemory"));
             for (var mem = [], i = 0; !memory.atEnd(); memory.moveNext()) mem[i++] = { cap: memory.item().Capacity / 1024 / 1024, speed: memory.item().Speed }
             //系统疑息
             var system = new Enumerator(service.ExecQuery("SELECT * FROM Win32_ComputerSystem")).item();
             var physicMenCap = Math.ceil(system.TotalPhysicalMemory / 1024 / 1024), curUser = system.UserName, cpuCount = system.NumberOfProcessors
             return { cpuType: cpuType, cpuCount: cpuCount, hostName: hostName, curUser: curUser, memCap: physicMenCap, mem: mem }
         }
  
  
  



阅读(143) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~