With PowerShell you can kill a process with the Stop-Process cmdlet. While the Get-Process cmdlet let’s you get a listing of processes from a remote machine, sadly Stop-Process doesn’t allow you to connect to a remote machine.

Most possibilities in PowerShell are just .NET and WMI monikers. So as soon as PowerShell doesn’t allow me to do something, most of the time I can find a way of addressing .NET or WMI through PowerShell.

One of my students asked me whether it’s possible to kill a SCOM Console on a remote machine. Here’s how, by using WMI and PowerShell. Just replace ServerX and the name of the process with the correct names.

# one-liner from the PowerShell prompt
(Get-WmiObject Win32_Process -computername 'ServerX' | where { $_.name -eq 'Microsoft.EnterpriseManagement.Monitoring.Console.exe' }).Terminate()

# from a powershell script
$a = Get-WmiObject Win32_Process -computername $computername | 
where { $_.name -eq 'Microsoft.EnterpriseManagement.Monitoring.Console.exe' }