How to remotely close/kill application on ms windows

30,390

There are several approaches you can take to remote kill processes from a CLI:


Powershell

Assuming you have an account with the requisite permissions, and have configured Powershell for remote use (not covered in this answer, but here's a free e-book from Don Jones covering how to get set up,) you can use one of several Cmdlets to remotely kill processes.

Stop-Process via Invoke-Command

You should be able to use Stop-Process along with an Invoke-Command (or by opening a more permanent remote session).

Invoke-Command -ComputerName RemoteComputer -ScriptBlock {Stop-Process processname}

This would be my preference, but requires some configuration in advance, so is not ideal in every situation.


Built-in Solutions

Taskkill.exe

Taskkill is provided on recent Windows machines, and can be used remotely with the /s parameter.

Example:

taskkill /s remotecomputer /pid processID

Sysinternals Tools

You can also use either of PSKill or PSExec (available at live.sysinternals.com) to terminate processes.

PSKill

Similar to Taskkill, but not provided on Windows machines by default.

Example:

pskill \\remotecomputer <process ID | name>

PSExec

Using PSExec, on the other hand, you can run any command you would normally use to manage processes locally.

Example:

psexec \\remotecomputer taskkill /pid processID
Share:
30,390

Related videos on Youtube

masterdany88
Author by

masterdany88

Full-stack Java/Gwt Web Developer. Interested in software quality and software architecture. Always looking for new opportunities to learn something new and usefull. Main career goal: Software Architect position. Methodologies: Clean Code Design Patterns Java EE Architecture Agile JAVA: Design and implementation of Java EE based applications, using: PlayFramework2, Spring, GWT, JPA/ Hibernate, REST, SBT, Maven, Ant. WEB: Bootstrap, HTML5, JQuery. DB: MSSQL, MySql, H2DB. LINUX

Updated on September 18, 2022

Comments

  • masterdany88
    masterdany88 over 1 year

    I wonder is it possible to turn off/kill/close an application on ms windows xp. On linux machine I've alway login by ssh and the use shell command. How it works on windows? Is there any ssh build in serwer?

    I would like to not use gui. I prefer shell/cmd.

    • sean christe
      sean christe over 8 years
    • masterdany88
      masterdany88 over 8 years
      If I am a domain admin I can kill apps on computer in domain When I have higher permissions?
    • Frank Thomas
      Frank Thomas over 8 years
      Windows, (until server2016 is released) does not support SSH natively. Most people use the SysInternals Suite's PS tools like PSKill. PSExec is a remote shell utility like SSH (though not at all secure for crossing the Internet). You do need to be in the administrators group on the remote PC, either by virtual of your domain membership and roles, or defined locally. you do not need more access than local admin to kill processes. It is possible to connect to a system as the SYSTEM account with psexec -s.