Shell_exec output gives problem in exeoutput but works fine in browser


#1

$uniqueKey = shell_exec(‘wmic bios get serialnumber 2>&1’);
$uniqueKey = str_replace(‘SerialNumber’, ‘’, $uniqueKey);
$uniqueKey = trim($uniqueKey);

Above code workd fine in browser but it shows the following message when executed inside exeoutput environment:
The current directory is invalid.
Please help, its really urgent.


#2

Yes, for some reason, shell_exec doesn’t work for wmic.
If you use it to computer a unique system ID, it would be better to use the built-in ExeOutput function designed for that:
For instance:
https://www.exeoutput.com/help/customheaders#tutorial-how-to-send-a-unique-computer-id-to-a-remote-server

Create a simple HEScript function (how to do it: https://www.exeoutput.com/help/addscript)

function ReturnID: String;
begin
Result := GetManualHardwareID(2)
end;

and call it from PHP:

$path = exo_return_hescriptcom ('UserMain.ReturnID', '');

#3

Hi, The reply was too late but I am happy that Exeoutput can accomplish that.
However, I also found another way out. If we set a manual location for the Data folder in settings, wmic starts working with perfection. I have done it in Windows 10 pro, havent tried it in other OS versions. If anybody gets it working in other OS variants, please let us know.

Thanks.