<< Back to Script Library

Kill Process by Force (PSKill)

Downloads SysInternals tool, pskill.exe and execute it against a process.
Version: 1.0.1
Created: 2018-07-12
Modified: 2018-07-12
Creator: Niron Koren
Downloads: 424
The Script Copy Script Copied to clipboard
function Stop-ProcessByForce {
[String]$Source = "https://live.sysinternals.com/pskill.exe",

[string]$Destination = "$env:TEMP\pskill.exe",


try {
    Invoke-WebRequest -Uri $Source -OutFile $Destination
catch {
    Throw "Could not download pskill.exe from $Source"

Start-Process -FilePath $Destination -ArgumentList ($ProcessID, "/accepteula")


if ((Get-Command "pskill.exe" -ErrorAction SilentlyContinue) -eq $null) 
    Stop-ProcessByForce -ProcessID $args[0]
else {
    Start-Process -FilePath "pskill.exe" -ArgumentList ($args[0], "/accepteula")