The following I can run in the command Prompt with no problem:
powershell -noexit "& ""C:\wamp\www\mypowersher.ps1”""
But I want to add it to my PHP script. Is it possible?
I tried using exec but it did not work.
$psPath ='"C:\\WINDOWS\\system32\\WindowsPowerShell\\v1.0\\powershell.exe"';
$psDIR = 'C:\\wamp\\www\\mypowersher.ps1';
$psScript = 'mypowersher.ps1';
$runScript = $psDIR. $psScript;
$runCMD = $psPath." "& ".$runScript." 2>&1"";
exec( $runCMD);
I think it’s possibly a problem with configuration since your description is unclear. So try turning
safe_mode= onon your WAMP server.Additionally you can try system() if it makes any differences.