Stop Process on Network Machine with .Net

旧时模样 提交于 2019-12-11 01:45:36

问题


In my project, I am going to do that : There is a server in restaurant, and some pos machines which are running on Windows XP called Radiant systems. There will be a .exe on server, and this .exe will stop running some process on Radiant Poses. It is possible with .Net Remoting. But it requires to write an .exe on the Radiant Poses, but I dont want to do that. Think there is no problem on network access on Main Server in restaurant and Radiant Poses in restaurant. Is it possible to do that without using .Net Remoting?


回答1:


One way could be, to use Remoting to call a KillProcess() method that would in turn call the Process.Kill method to kill a process. This article is worth looking at.




回答2:


Do you really need a programming solution for this? Take a look at the command line tools that are available with Windows XP, namely the taskkill command. It allows to kill processes on a local or remote system.

Syntax

taskkill [/s Computer] [/u Domain\User [/p Password]]] 
         [/fi FilterName] [/pid ProcessID]|[/im ImageName] [/f][/t]

...

Examples

The following examples show how you can use the taskkill command:

taskkill /pid 1230 /pid 1241 /pid 1253
taskkill /f /fi "USERNAME eq NT AUTHORITY\SYSTEM" /im notepad.exe
taskkill /s srvmain /f /im notepad.exe
taskkill /s srvmain /u maindom\hiropln /p p@ssW23 /fi "IMAGENAME eq note*" /im *
taskkill /s srvmain /u maindom\hiropln /fi "USERNAME ne NT*" /im *
taskkill /f /fi "PID ge 1000" /im *


来源:https://stackoverflow.com/questions/3155654/stop-process-on-network-machine-with-net

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!