Hi, the following code worked fine on my Windows 10 and Windows 7 PCS and returned the serial number:
$uniqueKey = shell_exec('wmic bios get serialnumber 2>&1');
$uniqueKey = str_replace('SerialNumber', '', $uniqueKey);
$uniqueKey = trim($uniqueKey);
But it didnot work in client machine and sent “Unknow” in response to my server.
In Exeoutput, I tried HEScript as below:
function GetMyCPUID: String;
begin
Result := GetManualHardwareID(2);
// Add here anything you want to customize the result.
end;
And i executed following command in the command prompt
wmic cpu get ProcessorId
The results donot match at all.
Similarly, I tried 0, 1 and 3 as parameters in GetManualHardwareID but none of the results match the result of following command in command prompt
wmic diskdrive get serialnumber
I need the hard disk unique serial number to identify the installation machine. I am trying to check on every execution of my application whether it is running on the same hard disk it was installed. If not, it should demand reactivation.
0 parameter just returns a 6 character id as: A123-BDC1
1 parameter returns a long string as SCSI\DISK&VEN_AAA&PROD_BBB111B1B1B-11BB\1&1111B11B&1&111111
3 parameter returns: DISK&VEN_AAA&AAVEN_AAA
None of the results look like a serial number. in cmd, WMIC gave result as: 111111111111
Note: I have changed all numerals to 1 and characters to A B
Please tell me what I need to do in order to fetch the actual serial number of hard disk. None of these look unique to me. They might clash with some other vendor.