Running Powershell command from PHP returns blank page
hi. :-)
i have script :
<?php $q = shell_exec('powershell get-help'); echo $q; ?> this works , gives me output.
but... when change get-help get-vm gives me blank page ouput. have simillar problems other hyper-v cmdlets.
this code 1:
<?php $q = shell_exec('powershell get-vm'); echo $q; ?> this code gives me blank page.
code 2:
<?php $q = shell_exec('powershell start-vm 'vm1''); echo $q; ?> this code gives me cannot find vm name.
what's problem, change in script or system settings.
note: commands work , gives me output when run cmd
things did:
1. changed execution policy unrestricted
2. added 2<&1 @ end of shell_exec.
thanks in advance.
hi,
i think should run powershell adminitrator vms.
start-process "$pshome\powershell.exe" -verb runas -argumentlist '-command "get-vm"'
regards,
yan li
regards, yan li
Windows Server > Windows PowerShell
Comments
Post a Comment