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

后端 未结 9 662
时光取名叫无心
时光取名叫无心 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 03:55

    You can use

        $hdserial =`wmic DISKDRIVE GET SerialNumber 2>&1` 
    

    or

        $hdserial =`wmic bios get serialnumber 2>&1` 
    

    Then you can echo it.

    Based on Patrick Daryll Glandien's hint, you can execute following on *nix based machines. $hdserial= hdparm -I /dev/hda

    hdparm -i /dev/sda returns lesser info. But as hdparm needs root access, it did not run with php for me.

    The '2>&1' part is used from the suggestion here.

提交回复
热议问题