python get registry infomation

原创 2012年03月23日 11:41:55
MRAB schrieb:
> Jorge wrote:
>> I need to know how to get the hardware serial number of a hard disk in 
>> python.
>>
> For Windows, see http://www.daniweb.com/forums/thread187326.html

This recipe uses the function GetVolumeInformation(), which does not
return the hardware serial number.

 From the microsoft documentation:
  This function returns the volume serial number that the operating
  system assigns when a hard disk is formatted. To programmatically
  obtain the hard disk's serial number that the manufacturer assigns,
  use the Windows Management Instrumentation (WMI) Win32_PhysicalMedia
  property SerialNumber.

The WMI method is e.g. described here:
http://www.velocityreviews.com/forums/t359670-wmi-help.html


import wmi
c = wmi.WMI()
for pm in c.Win32_PhysicalMedia():
     print pm.Tag, pm.SerialNumber

or to retrieve the serial number for the installation drive:

serial = c.Win32_PhysicalMedia(["SerialNumber"], 
Tag=r"\\.\PHYSICALDRIVE0")[0].SerialNumber.strip()


Regards,

Dietmar


http://mail.python.org/pipermail/python-list/2002-August/735262.html

 

 

python version 2.7 required,which was not found in the registry

安装MySQL-python-1.2.5.win32-py2.7 (64位系统也可以安装)时,出现问题:python version 2.7 required,which was not found ...

Python Version 2.7 required which was not found in the registry

在使用“MySQLdb”操作MySQL数据库时,提示错误:ERR import MySQLdb ImportError: No module named MySQLdb,然后去下载安装包“MySQL-...

安装cx_Oracle报错python version 3.4 required, which was not found in the registry

在安装https://pypi.python.org/pypi/cx_Oracle/5.2.1#downloads 下载了cx_Oracle,安装时提示python version 3.4 requi...

Python version 2.7 required, which was not found in the registry

转自:http://www.cnblogs.com/min0208/archive/2012/05/24/2515584.html 安装setuptools的时候,不能再注册表中识别出来pyth...

解决安装MySQL-python出现的:Python version 2.7 required, which was not found in the registry

安装MySQL-python-1.2.3.win-amd64-py2.7.exe,时提示:Python version 2.7 required, which was not found in the...

python ftp get

  • 2016年12月12日 11:25
  • 4KB
  • 下载

SAP CRM WEBUI开发时,ORDERSAVE_BADI 中warning/infomation消息在UI显示不出来

最近,在进行CRM的WEBUI开发时,我想在页面单据保存调用ORDERSAVE_BADI时做一些自己的处理,然后根据处理在界面上报出一些消息。       我用的是SAP的消息函数 CRM_MESSA...

Air Infomation System 基于控制台的航班信息系统(方法总结)

//删除航班的方法 //此处当独写的一个方法来检测输入的数是否符合要求,若不符合要求,则重新输入。 首先我想把它写在delete_flight方法体中,但是当我把变量id封装到for循环中后,for循...
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:python get registry infomation
举报原因:
原因补充:

(最多只允许输入30个字)