1

To put some context, I use the Posh SSH module to connect to linux machines on other servers and invoke command to get information of the current health of the machine.

When I use the command :

Invoke-SSHCommand -Index 0 -Command "vm_manage.sh status"

I got a truncated output of the command : output

This is normally the correct output for the command :

outputok

How can I make sure that I have the full output in powershell ?

Thanks a lot

su7
  • 66
  • 1
  • 7
  • idk the ```Invoke-SSHCommand ``` cmdlet, but what happens if you do: ```$result = Invoke-SSHCommand -Index 0 -Command "vm_manage.sh status" ``` and then ```$result | ft *``` ? – Toni Oct 27 '22 at 09:52
  • @Toni thanks for your answer ! but the result is the same (adding duration of the cmdlet) – su7 Oct 27 '22 at 09:59
  • I see, seems the output is stored in a attribute, does ```$result.output | ft *``` give you more – Toni Oct 27 '22 at 10:07
  • It's working ! I got the correct output with `$result.output | ft *`. I also found that adding the parameter `-ShowStandartOutputStream` is working too. Anyway thanks a lot @Toni – su7 Oct 27 '22 at 10:13

1 Answers1

0

Adding parameter -ShowStandartOutputStream is enough to have the correct output

Invoke-SSHCommand -Index 0 -Command "vm_manage.sh status" -ShowStandartOutputStream

su7
  • 66
  • 1
  • 7