VMware Cloud Community
nicholas1982
Hot Shot
Hot Shot
Jump to solution

Unable to Get Complete vim-cmd Output using Posh-SSH

I've never encountered this issue before with Posh-SSH.

I'm trying the following vim-cmd commandvim-cmd hbrsvc/vmreplica.getState vmID and the complete output is not showing with the exitstatus=1 

The command to get the vmID works fine > Invoke-SSHCommand $ssh -Command "vim-cmd vmsvc/getallvms | grep "VM Name" 

The command to get VM Replica state does not work > (Invoke-SSHCommand $ssh -Command "vim-cmd hbrsvc/vmreplica.getState 24").output 

KB Article Related to these command below. https://kb.vmware.com/s/article/2148376

This does work perfectly via Putty or Terminal, Hope someone can help?

nicholas1982_0-1619234505966.png

nicholas1982_1-1619234586591.png

 

 

 

Nicholas
0 Kudos
1 Solution

Accepted Solutions
nicholas1982
Hot Shot
Hot Shot
Jump to solution

Never mind All, I figured it out, I needed to use Invoke-SSHStreamShellCommand

Invoke-SSHStreamShellCommand -ShellStream $stream -Command "vim-cmd hbrsvc/vmreplica.getState 24" 

nicholas1982_0-1619235627400.png

 

 

 

Nicholas

View solution in original post

0 Kudos
1 Reply
nicholas1982
Hot Shot
Hot Shot
Jump to solution

Never mind All, I figured it out, I needed to use Invoke-SSHStreamShellCommand

Invoke-SSHStreamShellCommand -ShellStream $stream -Command "vim-cmd hbrsvc/vmreplica.getState 24" 

nicholas1982_0-1619235627400.png

 

 

 

Nicholas
0 Kudos