You can use the WTSTerminateProcess API or use the Jwscl (Windows Security Library) Terminal Server ( TJwWTSProcess offers the Terminate method).
An example of a small code:
var TS: TJwTerminalServer; begin TS := TJwTerminalServer.Create('Remote'); try if TS.EnumerateProcess then begin for i := 0 to TS.Processes.Count -1 do begin if TS.Processes[i].Name = 'notepad.exe' then begin TS.Processes[i].Terminate; end; end; end; finally TS.Free; end; end;
Remko source share