Python使用WMI获取主板和CPU序列号

安装wmihtml

pip install pywin32
pip install wmi

代码python

import wmi
c = wmi.WMI()
#获取主板序列号
c.Win32_BaseBoard()[0].SerialNumber.strip()
#获取CPU序列号 速度有点慢
c.Win32_Processor()[0].ProcessorId.strip()

关于WMI,有两篇文章以为还能够,贴在下面备忘:
使用Python玩转WMI
Python WMI获取Windows系统信息
python利用WMI监控windows状态如CPU、内存、硬盘windows

相关文章
相关标签/搜索