What is the correct way of determining if a process is running, for example FireFox, and stopping it?
I did some looking around and the best way I found was this:
If you don't need to display exact result "running" / "not runnuning", you could simply:
ps notepad -ErrorAction SilentlyContinue | kill -PassThru
If the process was not running, you'll get no results. If it was running, you'll receive get-process output, and the process will be stopped.
get-process