Wednesday, March 19, 2008

collecting dmidecode information

dmidecode is very useful to look into system bios information. However, dmidecode -s requires long parameter. Since I prefer dump all information on one screen, I wrote this simple tool.

#!/usr/bin/python
import os, sys, commands, re
for p in commands.getoutput('dmidecode -s').split('\n'):
  if re.search('^ ',p):
    print '%-25s: %s' % (p.strip(), \
        commands.getoutput('dmidecode -s %s' % p) )


Use this with 'sudo'. Especially this is useful for 'DELL service TAG' information. Service tag text can be copy and pasted. :)

Anyone wants to challenge stuffing this into one line? One line bash with pipes are welcome, too.

2 comments:

Joel said...

There is a project to implement a python dmidecode module. Please check it out at http://projects.autonomy.net.au/dmidecode/

Raymond said...

Joel, Thanks for the nice link. I didn't google that. Shame on me. :) Anyway, at the time, I was just lazy and I needed just one information out of it. Serial number.
I looked at the project link and mission statement sounds feasible.