I am trying to reboot Linux machine from PowerShell script running on Windows 10. I use Posh-SSH module. All other commands I send via SSH session work fine, but reboot has no effect no matter what I tried. Via regular SSH client session (Putty or BitWise) these commands work and device reboots immediately. Below is a sample command:
Invoke-SSHCommand -SSHSession $session -Command "nohup reboot >/dev/null &" -EnsureConnection
I tried with/without nohup. Tried shutdown -r, reboot, reboot -f. Tried using exit command Tried sleep/timeout.
All these worked as expected in SSH console, but nothing worked via Posh-SSH. What am I missing that's different in Posh-SSH?