running powershell on php that store in winscp

Advertisement

normanong
Joined:
Posts:
1
Location:
malaysia

running powershell on php that store in winscp

hi guys, i am new to powershell and also winscp. the problem that i currently stuck are how the php script run the ps1 script on the winscp . both file are save in the same directory.

this is my php script
<?PHP
  echo Shell_Exec ('powershell.exe -executionpolicy bypass -NoProfile -File ".\MyPSscript.ps1"');
?>

this is my powershell script

Try {
#Store all processes in $MyProcesses
$Processes = Get-Process

#Convert $Processes in HTML
$MyHTMLCode = $Processes | ConvertToHTML

#Return the HTML code to the PHP Page
Return $MyHTMLCode
}
Catch {
#Something went wrong
Return "Oops: Something went wrong.<br />$($_.Exception.Message)<br />"
}

Reply with quote

Advertisement

zayden
Guest

Re: running powershell on php that store in winscp

martin wrote:

I do not see what does your question have to do with WinSCP.
sry ya , first time using this forum . the question that i want to ask is , it's possible to let the php.file that i store on winscp to call the powershell script on local C: drive ?

Reply with quote

Advertisement

You can post new topics in this forum