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

后端 未结 9 729
时光取名叫无心
时光取名叫无心 2020-12-17 03:36

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.

9条回答
  •  一个人的身影
    2020-12-17 04:08

    Run the following with shell_exec (test in command prompt if needed):

    wmic path win32_physicalmedia get Tag,SerialNumber
    

    DISKDRIVE doesn't get the actual serial number for my drive that shows plugged in through an IDE channel. the above seemed to get the actual serial numbers for all of my drives. Tag will also return you what type of drive it is which may be helpful for identifying different drives.

    Example output:

    SerialNumber     Tag
    WD-WX55D33JQNZ4  \\.\PHYSICALDRIVE4
    S1OKIJNH938475   \\.\PHYSICALDRIVE0
    WD-CV44HJ5L765Y  \\.\PHYSICALDRIVE1
    WD-WX41D65SD1UU  \\.\PHYSICALDRIVE2
    WD-WXB1SD3OIJHG  \\.\PHYSICALDRIVE3
                     \\.\CDROM0
    

提交回复
热议问题