Powershell - Enter-PSSession lazarus / 34-Windows ---------------------------------------------------------------------- HomeBoy38 · 2023-10-17 10:19 Hello, I have a TAsyncProcess [poNoConsole, poStdErrToOutput, poUsePipes] which executes 'C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe'. The procedure ReadData reads the Output into a TStringList until I get back the PowerShell prompt. I had no issue when executing all the commands I needed, my TStringList was correctly filled with my powershell commands outputs, except sometimes. Those commands were remotely sent to other machines, so, in order to be more effective, I decided to change my code to open a remote session (Enter-PSSession) and input my commands directly on th machine. Once the Enter-PSSession is done, I correctly have the remote powershell prompt, I see the command I run but no more output, just the prompt back. No error message, no command result. If I manually open a powershell, enter-pssession and input my commands, the output is ok. Anyone has an idea why I loose my commands outputs once under Enter- PSSession? Thanks ---------------------------------------------------------------------- marcov · 2023-10-17 10:40 There was a strange case with powertoys PSEXEC once. But it was on the input side. Try to set  poPassInput and see if that helps. ---------------------------------------------------------------------- HomeBoy38 · 2023-10-17 12:18 I tried poPassInput, but in that case, I do not catch anything anymore (I have not investigated why) EDIT: I changed one of the commands. Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i s := 'Get- CimInstance -ClassName Win32_ComputerSystem | Out-File -FilePath .\Process.txt' + LineEnding;  The Process.txt file is created on the remote computer, so I am sure I am on the computer when executing my command. The Process.txt file is... empty! So I am still wondering what happend to my command output? EDIT2: I have no idea why but after a Enter-PSSession, if I run my commands with "invoke-command", the output is back to my TAsyncProcess Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i s := 'Invoke-Command {Get-CimInstance -ClassName Win32_ComputerSystem}' + LineEnding;as an example So far, so good I think I solved my issue, maybe it can help anyone else, but I leave the thread unsolved if someone has the explanation on this (maybe a powershell thing, I am not too expert in it) EDIT3: new issue found, if the application is minimized, the powershell commands are failing somehow, I still have not investigate why  :'( EDIT4: end of story? I found the EDIT3 issue: when my application is minimized, the powershell command issued is split onto several lines, so by handling this, I can handle my result. Really strange behaviors with powershell