# $cs.Sys_KillProcess

> Kills every running process whose name contains processname as a substring (case-insensitive), not just an exact match — for example "chrome" would also match and kill a.

Source: https://docs.capaone.com/capainstaller/powerpacks/cs-sys-killprocess/  
Product: CapaInstaller — a separate CapaSystems product; do not apply this page to any other.

### Description

Kills every running process whose name contains `processname` as a substring (case-insensitive), not just an exact match — for example `"chrome"` would also match and kill a process named `"chromehelper"`. Pick a name specific enough to avoid collateral kills. Waits for each killed process to fully exit before returning.

### Syntax

$cs.Sys_KillProcess(string processname)

### Parameters

#### processname (String)

Name (or substring of the name) of the process(es) to kill. The `.exe` extension is optional.

### Return value

None.

### Example

**PowerShell**

Force-close an application before an in-place upgrade so its files aren't locked:

```powershell
if ($cs.Sys_ExistProcess("Firefox.exe"))
{
  $cs.Job_WriteLog("Killing Firefox before continuing install")
  $cs.Sys_KillProcess("Firefox")
}
```

Kill a specific helper process by its full name rather than a short substring, to avoid accidentally matching unrelated processes (for example `"note"` would also match `OneNote` or `notepad++`):

```powershell
$cs.Job_WriteLog("Stopping the vendor update helper before uninstalling the application")
$cs.Sys_KillProcess("VendorUpdateHelper.exe")
```

Clean up a known set of leftover processes during uninstall:

```powershell
foreach ($processName in @("AppMain", "AppTray", "AppUpdater"))
{
  if ($cs.Sys_ExistProcess($processName))
  {
    $cs.Job_WriteLog("Killing leftover process $processName")
    $cs.Sys_KillProcess($processName)
  }
}
```

### Related functions

[$cs.Sys_ExistProcess](/capainstaller/powerpacks/cs-sys-existprocess/) [$cs.Sys_WaitForProcess](/capainstaller/powerpacks/cs-sys-waitforprocess/) [$cs.Sys_WaitForProcessToExist](/capainstaller/powerpacks/cs-sys-waitforprocesstoexist/)
