Solved, see n. 3
Hi all,
I want to get output from powershell. I use the Erel's snippet.
It arrives to log "ok3", but never to "ok4".
In CLI powershell -Command Get-Command -name *Get-app* works.
Any idea about my error ?
Here the code
Hi all,
I want to get output from powershell. I use the Erel's snippet.
It arrives to log "ok3", but never to "ok4".
In CLI powershell -Command Get-Command -name *Get-app* works.
Any idea about my error ?
Here the code
Code:
'Non-UI application (console / server application)
#Region Project Attributes
#CommandLineArgs:
#MergeLibraries: True
#End Region
Sub Process_Globals
End Sub
Sub AppStart (Args() As String)
Log("Hello world!!!")
Dim lista As String
PowerShellScript("Get-Command -name *Get-app*")
Log(lista)
End Sub
Public Sub PowerShellScript(s As String) As ResumableSub
Log("OK2")
s = s.Replace(CRLF, ";").Replace("""", "'")
Dim shl As Shell
shl.InitializeDoNotHandleQuotes("shl", "powershell.exe", Array("-Command", s))
shl.Run(-1)
Log("OK3")
Wait For shl_ProcessCompleted (Success As Boolean, ExitCode As Int, StdOut As String, StdErr As String)
Log("OK4")
Dim res As ShellSyncResult
res.ExitCode = ExitCode
res.StdErr = StdErr
res.StdOut = StdOut
res.Success = Success
If StdErr <> "" Then
Log(StdErr)
If ExitCode = 0 Then res.ExitCode = 1
End If
Log("OK5")
Log (res)
Return res
End Sub
Attachments
Last edited: