Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 283
simplfuzz Avatar asked Apr 02 '09 10:04

simplfuzz


People also ask

What is the serial number of hard drive?

Open the PC case and look for a sticker or label on your physical hard drive. The serial number is listed after the word “Serial No”, “S/N” or “SN”. Some of hard drives have the QR code printed on the label.

How do I find my SSD serial number?

Serial Number is on a separate label and is on the bottom of the SSD. Main label can be on the top or bottom of the SSD.


1 Answers

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.

like image 126
OIS Avatar answered Oct 02 '22 10:10

OIS