I am trying to build some simple monitoring of scheduledtasks to see if they maybe fail, or get disabled. This in itself should be fairly simple, and in the most part is. However I have found an issue that I am struggling to understand let alone resolve.
get-scheduledTask schtasks.exe /query /V /FO CSV
These list scheduled tasks nicely, but in my case when run interactively the results are as expected (although in schtasks some of the tasks get duplicated), however when I run the code through a scheduled task then some of the scheduled tasks fail to appear in the list.
I happen to be on a windows cluster which may be doing something clever as the missing tasks are missing on the other node in the cluster.
Is anyone able to assist me understand what the command is doing? I do not believe get-scheduled task can go to a remote server, so not sure how this is possibly getting the wrong information
Thanks in advance for any help or suggestions