当前位置:   article > 正文

new ActiveXObject ("WbemScripting.SWbemLocator") Automation 服务器不能创建对

wbemscripting.swbemlocator
function getSysInfo(){
[b] var locator = new ActiveXObject ("WbemScripting.SWbemLocator"); [/b]
var service = locator.ConnectServer(".");
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"));
var mem=0;
var memSpeed=0;
for (var mem=[],i=0;!memory.atEnd();memory.moveNext()){
mem+=memory.item().Capacity/1024/1024
memSpeed=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,hostName:hostName,curUser:curUser,memSpeed:memSpeed,mem:mem};
}


在做测试时,会弹出时候允许ActiveX交互,选择允许。而在服务器上运行时可能会出现“Automation 服务器不能创建对象”的javascript错误。出现此错误时,在工具-->Internet选项-->安全-->自定义级别 -->启用"对没有标记为安全的ActiveX控件进行初始化和脚本运行",即可解决此问题
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/2023面试高手/article/detail/147976
推荐阅读
相关标签
  

闽ICP备14008679号