I've been asked to find a way to connect from a Linux system to one of several Windows servers. What we need to do ideally is connect to whatever Windows server is causing the trouble, kill a process, and restart the process. Ideally, it would be something that could be put into a script that could be run from the Linux computer. All the solutions I've found so far involve some kind of remote desktop connection, but like I said, a command line solution is preferable? Is this possible? And I apologize...not quite a programming question, but I'm at my wit's end.
I use Cygwin with OpenSSH server on the Windows box ( but it is available without Cygwin in an installer ), and can log in over SSH from the Linux box to do stuff with a command line. I don't kill processes, I make builds. But the same concept applies.
Cygwin's default ps/kill doesn't allow you to access Windows processes to kill them.
Use cygwin + openssh + windows services to get an SSH user on the machine.
Once you're in an SSH commandline, you can use standard Win32 tools to kill a process, for instance -
taskkill /f /im notepad.exe
Or add other commandline process tools for Win32.
EDIT : or you can just use ps -elW
to view all the windows processes, and then pass that PID into taskkill.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.