//WMI 获取系统信息 //📝 com.wmi 库文档: doc://library-reference/com/wmi.md //💻 WMI 查询入门](doc://example/COM/WMI/query.aardio //相关范例: 范例\操作系统\系统版本信息;范例\操作系统\硬件信息\查询硬件信息 import com.wmi; var osInfo = com.wmi.get("os"); print(osInfo.Caption());//操作系统 print(osInfo.Version());//版本 //获取操作系统安装时间 var installDate = com.wmi.get("os","installDate") print("Windows 操作系统安装时间:", installDate.format("%Y年%m月%d日 %H时%M分%S秒") ); import sys.cpu; var cpu = sys.cpu.getInfoByWmi() print(cpu.DeviceID);//CPU print(cpu.Name);// print("CPU 核心数:",cpu.NumberOfCores); print("CPU 逻辑核心数:", cpu.NumberOfLogicalProcessors); print("CPU 最大速度:", math.round(cpu.MaxClockSpeed/1000,2) + "GHz"); print("CPU 当前速度:", math.round(cpu.CurrentClockSpeed/1000,2) + "GHz"); print("CPU 位宽:" ,cpu.AddressWidth); /* import sys.tpmInfo; var tpmInfo = sys.tpmInfo.get(); if(tpmInfo){ print("支持 TPM"); print("TPM 是否启用:",tpmInfo.enabled); print("TPM 是否激活:",tpmInfo.activated); print("TPM 支持版本:",tpmInfo.version) } else { print("不支持 TPM"); } */ for index,mem in com.wmi.each("win32_physicalmemory") { print("内存容量",..math.size64(mem.capacity()).format()); } for cfgAdapter,index in com.wmi.eachProperties( "SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled=true"){ print(cfgAdapter.Description);//网卡 print(cfgAdapter.DefaultIPGateway[1]);//默认网关: print(cfgAdapter.DNSHostName[1]);//计算机名 print(cfgAdapter.IPAddress[1]);//IP地址 print(cfgAdapter.DNSServerSearchOrder[1]);//默认 DNS print(cfgAdapter.IPSubnet[1]);//子网掩码 print(cfgAdapter.MACAddress);//M AC地址 } var wmi = com.wmi(); var display = wmi.instancesof("Win32_videocontroller") for index, video in com.each(display) { print(video.DeviceId);//显示卡 print(video.Name); print(math.size64(video.AdapterRAM).format()) }