Shell_exec output gives problem in exeoutput but works fine in browser

$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.

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:

Create a simple HEScript function (how to do it:

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

and call it from PHP:

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

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.