Good day everyone. My question is about calling a powershell script using PHP. So, if I am calling a PS1 script using ActiveDirectory module, there are no issues.
However, if I am calling PS1 scripts that includes the MSOnline module, it does not work (but PS1 script works locally on the server and MSOnline module is loaded). And as per checking, if the PS1 script is called by PHP, if I issue the get-module command, there is no MSOnline loaded.
This is how I call PS1 scripts from PHP: shell_exec('C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -executionPolicy Unrestricted -InputFormat none -File PATH\TO\FILE.ps1 '. "$variable");
If I check the available modules in PS1 via PHP, I can find the MSOnline but no loaded commands. Please see attached picture.