Our anti-piracy software identifies people according to their Hard Drive Serial. This I believe is a constant feature and will not change unless the user changes their primary physical drive - correct me if I am wrong? We use the WMI
python module to obtain the users Hard Drive Serial Number.
For 2 of our test computers the Hard Drive serial number has changed. But we haven't changed their hard drive at all.
What could cause such a problem? Is our code that identifies the serial not comprehensive across windows operating systems? I did notice that this post mentions you can get the wrong serial if a standard user process retrieves the serial no. But in our case the error has occurred on an admin user aswell.
Some important information:
- Both of these test nodes run Windows 8 Professional
- One computer is a Toshiba laptop
- The other computer is an Acer Iconia tablet
- The tablet was recently updated from Windows 8 to Windows 8.1 and I noticed that the serial changed after this update
- The laptop has an admin user who experienced the issue. The tablet has a standard user who experienced the issue.
Also is the Hard Drive Serial number the MAC address of the hardware device or something else?
Code to obtain the Hard Drive Serial number:
c = wmi.WMI()
for item in c.Win32_PhysicalMedia():
if "PHYSICALDRIVE" in str(item.Tag).upper():
serialNo = item.SerialNumber
break
Edit: A short script that retrieves a users Hard Drive Serial number as a normal process and as an elevated/admin process.
Note: For me it outputs exactly the same serial number no matter as a user or as a admin. Does this script do the same for you aswell?
import os
import sys
import wmi
import win32com.shell.shell as shell
ASADMIN = 'asadmin'
def get_elevated_privleges():
if sys.argv[-1] != ASADMIN:
script = os.path.abspath(sys.argv[0])
params = ' '.join([script] + sys.argv[1:] + [ASADMIN])
shell.ShellExecuteEx(lpVerb='runas', lpFile=sys.executable, lpParameters=params)
def get_hard_drive_serial():
c = wmi.WMI()
for item in c.Win32_PhysicalMedia():
if "PHYSICALDRIVE" in str(item.Tag).upper():
return str(item.SerialNumber)
return None
print "HD Serial as Regular User: " + get_hard_drive_serial()
get_elevated_privleges()
print "HD Serial as Admin User: " + get_hard_drive_serial()