Automation

 View Only
  • 1.  Unable to Get Complete vim-cmd Output using Posh-SSH

    Posted Apr 24, 2021 03:23 AM

    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

     

     

     



  • 2.  RE: Unable to Get Complete vim-cmd Output using Posh-SSH
    Best Answer

    Posted Apr 24, 2021 03:41 AM

    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