<< 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: 213
Tags:
The Script Try this script with ControlUp Copy Script Copied to clipboard
function Stop-ProcessByForce {
[CmdletBinding()]
Param(
[String]$Source = "https://live.sysinternals.com/pskill.exe",

[string]$Destination = "$env:TEMPpskill.exe",

[Parameter(Mandatory=$true)]
[int]$ProcessID
)

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")
}
START YOUR TRIAL

Get Your Download Link

Gain access to ControlUp from your PC. Register and get a link to start your Free Trial.