获取计算机硬盘主板CPU信息20200825

获取计算机硬件信息包括:硬盘序列号,cpu序列号,主板序列号

#!/user/bin/env python
#-*-coding: utf-8-*-
#@Time           : 2020/8/258:46
#@Author         : GodSpeed
#@File           : 获取计算机硬盘主板CPU信息.py
#@Software       : PyCharm
#需要安装的模块
#python -m pip install --upgrade pip 升级pip版本防止下面的模块安装失败
#pip install wmi -i https://pypi.tuna.tsinghua.edu.cn/simple

import wmi
import os

#Get computer hardware information: disk,cpu,board
def get_compter_hardware_infor():
    c = wmi.WMI()

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

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

    # 主板序列号
    for board_id in c.win32_BaseBoard():
        board_id = board_id.SerialNumber

    return hard_seral,cpu_seral,board_id



if __name__ == '__main__':
    hard_seral,cpu_seral,board_id = get_compter_hardware_infor()
    print('hard_seral=',hard_seral)
    # hard_seral= 0002_0D01_0012_D793.

    print('cpu_seral=',cpu_seral)
    #cpu_seral= CEEAFBFF002632FC

    print('board_id=',board_id)
    #board_id= P0HE52H238Z



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Narutolxy

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值