Uniface User Forum

 View Only

Implementing an OS Service with Windows Powershell

  • 1.  Implementing an OS Service with Windows Powershell

    Posted 02-07-2023 16:27
    While it is relatively easy to do something like this

    activate "Windows".CommandOut("cmd /c echo Hello World!", $1)
      and it is also possible to run a Powershell script with something like this

    activate "Windows".Command( "cmd /c start /wait /b /min %%"%%" powershell -ExecutionPolicy Bypass -Command %%"Write-Output (Hello World)%%" | Out-File temp.txt " )

    I have been unable to find a way to use CommandOut to capture Powershell output. Has anybody else encountered and resolved this issue? I have tried Write-Host, Write-Output and a few other variations but it does not appear that Powershell output goes where CommandOut can access it.

    ------------------------------
    Harjit Batra
    IT Director
    Rocket Forum Shared Account
    ------------------------------