How to get the Universal Unique Identifier (UUID) of the computer motherboard

font size: Small Medium Large

UUID is a unique hardware identifier assigned by the motherboard manufacturer.

wmic csproduct get uuid

wmic csproduct get uuid
UUID
03560274-043C-056F-0D06-CB0700080009

在这里插入图片描述

In ThinkPaHP5, call the wmic csproduct get uuid command of Windows to obtain the UUID of the motherboard,

public function getMotherboardUUID()
{
    // call WMIC command 
    exec('wmic csproduct get uuid', $output, $return_var);
    
    // result
    if ($return_var === 0 && isset($output[1])) {
        $uuid = trim($output[1]);
        return $uuid;
    }
    
    return false;
}