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

 

 

Xmanager在winxp系统安装完后,运行时提示“Failed to get the installation date from the system registry……”

Xmanager 再winxp系统安装完后,运行时提示“Failed to get the installation date from the system registry……”原因: Xman...
  • zhengshibo56
  • zhengshibo56
  • 2013年08月09日 13:14
  • 1174

Get USB Infomation

namespace ConsoleApplication1 { using System; using System.Collections.Generic; using System.M...
  • lk5423968
  • lk5423968
  • 2014年11月12日 14:04
  • 340

Docker - Cannot connect to the Docker daemon

Start docker, and pull bkimminich/juice-shop. Console says$ docker pull bkimminich/juice-shop Using ...
  • u011130746
  • u011130746
  • 2016年12月27日 18:21
  • 929

get the company infomation which we want to get

function get_myinfo($data,$infopara){ $preg = />([^  preg_match_all($preg, $data, $match); $nlast = ...
  • zzz_781111
  • zzz_781111
  • 2008年09月01日 09:51
  • 483

Xmanager Failed to get the installation date from the system registry的解决方法

出现了这个问题后,各种可能的想法都想到了,但是,一直得不到解决,后来查到了这样一种办法 1.打开Xbrowser 2.打开Help, 选择About Browser 3.点击Ente...
  • shenghuiping2001
  • shenghuiping2001
  • 2012年09月30日 22:40
  • 550

安装scipy或者numpy时弹出python2.7 was not found in the registry 的解决办法: python的注册与注销方法

参考链接: http://lijunwei1228ok.blog.163.com/blog/static/9738379720140231713138/ 参考链接: http://lijunwei...
  • xyw_Eliot
  • xyw_Eliot
  • 2014年12月12日 10:25
  • 1813

解决selenium2在IE11上出错的问题,如Unable to get browser

官方解决方案: https://github.com/SeleniumHQ/selenium/wiki/InternetExplorerDriver#required-configuration ...
  • chengly0129
  • chengly0129
  • 2017年03月30日 08:51
  • 853

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

Python version 3.3 required, which was not found in the registry python registry函数语法 在windows下...
  • jonathanzh
  • jonathanzh
  • 2016年09月11日 13:18
  • 1980

docker-registry搭建过程中遇到的问题

利用官方提供的registry镜像,将端口映射到主机的5000端口上,然后docker pull 镜像,报错如下: 根据报错提示解决方法: 1.自己添加证书走https    在registr...
  • weiguang1017
  • weiguang1017
  • 2015年06月18日 15:47
  • 9308

安装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...
  • cakecc2008
  • cakecc2008
  • 2017年01月03日 16:59
  • 1658
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:python get registry infomation
举报原因:
原因补充:

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