I'm working on a way to remotely stop and restart a process via PS and WMI. I can easily stop/terminate the process but I'd like to restart the process as well and I'm having issues doing that. Below is the script I use to remotely stop/terminate the process. Any idea what I can add to this that will then restart that same process?
$comp = read-host -Prompt "Enter computer name"
(Get-WmiObject Win32_Process -ComputerName $comp | ?{ $_.ProcessName -match "PhotoScreensaver.scr" }).Terminate()