Very new to using PS and hoping I can get a little assistance please. I haven't had any luck finding an answer in an existing topic.
How can I use the information I get from
New-TimeSpan -Start (get-process notepad).StartTime
and make that restart notepad after xx hours or xx minutes have gone by? Notepad is just an example of course, but I have several processes I need to monitor for uptime and have restarted at specific intervals.
I realize I can make a scheduled task to do the same from a simple .bat file, but I already have a PS script checking these processes' heartbeats. I'd like to add this bit of functionality within the same script.
Thanks so much for the assist!