Powershell remote execution with php exec function -


i trying run powershell command on remote computer with php script.

i have no trouble execution local powershell scripts. example, successful executed following code:

exec("powershell -command c:\wamp\www\pstest.ps1", $output, $return_var); 

output: "hello world", return code: 0

when execute following command prompt have no issues.

powershell -command invoke-command -computername computer.servername.local c:\wamp\www\pstest.ps1 

output: "hello world", return code: 0

however, when try execute same code within php script fails.

exec("powershell -command invoke-command -computername computer.servername.local c:\wamp\www\pstest.ps1", $output, $return_var); 

output: "", return code: 1

make sure account service running under has admin rights on target system. should fine if personal project @ home. may have rethink things if on corporate system.


Comments

Popular posts from this blog

OpenCV OpenCL: Convert Mat to Bitmap in JNI Layer for Android -

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -

python - How to remove the Xframe Options header in django? -