I have written a file watcher script that loops from the time it starts until about 11:00 PM.
It is an important script so I want a way to make sure it is running.
It is launched via the windows task scheduler using the “Powershell -File c:\Scripts\Script.ps1”
I can see that the script is running as the logs it produces continue to increment.
In my Health Monitor script I am using the following command to try and determinant if the script is running.
Get-WmiObject Win32_Process -Filter “Name=‘powershell.exe’ AND CommandLine LIKE ‘%Script.ps1%’”
Unfortunately it is not returning any info.
Any help is greatly appreciated!