Getting Serial Number of the Hard Drive Provided by the manufacturer through PHP

simplfuzz picture simplfuzz · Apr 2, 2009 · Viewed 65k times · Source

Getting Serial Number of the Hard Drive Provided by the manufacturer through PHP : How can it be done? I want to store it in a file.

OS : windows 2000,XP,ME,Vista...

Yes, I want the serial number of the hard drive of the Server.

Or can it be done through Adobe AIR? Or can it be done through a C program on Windows?

C:\Documents and Settings\Administrator>dir
 Volume in drive C has no label.
 Volume Serial Number is BC16-5D5F

Is this number : BC16-5d5f unique for a hard drive? How is it different from the manufacturer given serial number?

wmic DISKDRIVE GET SerialNumber

Displays only the following text on my Vista Machine:

SerialNumber

On my XP machine, the command is unrecognized.

Answer

OIS picture OIS · Apr 2, 2009

The following returns the disk serial number. Should work with multiple drives, you'll just get multiple results. Just run it with shell_exec.

wmic DISKDRIVE GET SerialNumber

wmic.exe is located in your windows system32 folder. And wmic does exist on WinXP, Ive used it there myself.

My result on Vista:

C:\Windows\System32>wmic DISKDRIVE GET SerialNumber
SerialNumber
20202020202054534241354c4*snip*

I do not know if all harddrives provides the serial number to the OS.

It seems the wmic command is only available on the professional versions of Windows XP, Windows Vista and Windows 7.