Win 7 reboot via Cygwin

Posted on Monday, June 24, 2013


I have an ESXi server that runs a Win-7 virtual server on it.
I use the Win 7 OS to run VSphere client so I can access the ESXi server and tweak it if necessary  (this is the cheap homebrew solution)

I run Cygwin on the win-7 machine and I use ssh to pull ports so I can attach to the server using Remote Desktop using a secure connection.



Well today I ran into an issue.  When I tried to log in I was met with this screen.




"The number of connections to this computer is limited and all connections are in use right now"


I still had Cygwin command line access to the machine so I looked around to see what I could do.






I found this post http://www.edugeek.net/forums/windows/31991-killing-remote-desktop-sessions.html [1]  wjere iser e-class suggested using the following command line commands from Cygwin (though they are really DOS commands)


>  quser


This did list the connection as still open, it also showed the ID



He also suggested using the following command to kill the session



>  logoff 2


(in my case the session id was 2 so I used 2 you may have another session ID)

And when I ran this it seemed to work, at least re-running the quser command did not bring anything up.  But when I tried to log back in I got the same results.

So I found this post  http://stackoverflow.com/questions/5104523/how-to-execute-shutdown-command-from-cygwin-in-windows [2] where a user Frankie suggested using the DOS shutdown command to reboot the server

I ran the command


>  shutdown /r /t 0


The server successfully rebooted and I was able to get in and open a Remote Desktop session.





References
[1]        Windows Thread, killing remote desktop sessions? in Technical; hi all, anyone any ideas as to how I can kill dead remote desktop sesisons?
                Accessed 06/2013
[2]        How to execute shutdown command from cygwin in windows

                Accessed 06/2013 

No comments:

Post a Comment