If you’ve ever created a WinForm GUI in Powershell you’ve probably dealt with not being able to click the X on the Form to close a hung command. Even by running the command separate from the GUI in a job or runspace you still need a way to force close your tool. An easy go-to might be to just kill powershell.exe, but what if you have multiple instances, how you do know which one to kill? Luckily this handy variable $PID exists, calling it will return the process ID of the current powershell instance. Check it out! 

Stop-Process -ID $PID