2

I am looking for a way to get system serial number using python.

Below is the command to get serial number using command prompt:

wmic bios get serialnumber

Is there any python library to get the same?

sheetal
  • 43
  • 1
  • 5

1 Answers1

5

Yes, you can run shell commands via subprocess

import subprocess
subprocess.check_output('wmic bios get serialnumber').decode("utf-8") 

You should get something like

SerialNumber \r\r\n< cencored > \r\r\n\r\r\n'

For more see this SO answer

pinegulf
  • 1,334
  • 13
  • 32