WMIC returned Unknow


#1

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.


#2

The GetManualHardwareID doesn’t return the direct system ID as wmic bios get serialnumber. It computes some additional hashsums before giving the system ID such as A123-BDC1.
To use the serial ID of the physical first disk, use parameter 3 and a specific hashsum will be returned from it.
For your client’s problem, did you ask them whether they get something by running wmic bios get serialnumber 2>&1 manually?


#3

No, we havent executed the command on client side. As you said parameter 3 will also return hash, is there no way to get the original hard disk serial number?


#4

Try to check the value of this global variable: HEPublicationDiskInfo
It should store information about the hard disk.