Python-wmi模块

介绍

获取windows硬件,系统信息

使用

pip install import wmi

系统信息获取

https://cloud.tencent.com/developer/article/1568596

硬件信息获取

import wmi


c = wmi.WMI()

# # 硬盘序列号
for physical_disk in c.Win32_DiskDrive():
    print(physical_disk.SerialNumber)

# CPU序列号
for cpu in c.Win32_Processor():
    print(cpu.ProcessorId.strip())

# 主板序列号
for board_id in c.Win32_BaseBoard():
    print(board_id.SerialNumber)

# mac地址
for mac in c.Win32_NetworkAdapter():
    print(mac.MACAddress)

# bios序列号
for bios_id in c.Win32_BIOS():
    print(bios_id.SerialNumber.strip())
posted @ 2021-01-28 12:07  Huise.J  阅读(1118)  评论(0编辑  收藏  举报