I have a powershell script that would output system variable values:
env_output.ps1
$Env:UserDomain
$Env:ComputerName
$Env:UserName
I can get an output when I use this php function to call powershell v5 file
$output_switch = shell_exec('powershell.exe -File C:\inetpub\env_output.ps1');
print_r ($output_switch);
But when I switch to to use powershell v7.4, I got no output.
$output_switch = shell_exec('pwsh.exe -File C:\inetpub\env_output.ps1');
print_r ($output_switch);
Windows 2019 Server with IIS and PHP.
Both powershell executables are in the system path variable.