Hi I have some powershell code that lists scheduledtasks (Get-ScheduledTask) and processes them. This code works when run interactively, however when run itself as a scheduled task then some scheduled tasks are missing off the list.
I have tried using schdtasks.exe and the same occurs, although sometimes this command duplicates some of the scheduled tasks.
My issue is that I cannot understand why interactively the code is fine, but through a service the code misses out some of the scheduled tasks?
If it help I am querying from a windows clustered service and the missing jobs seem to be those not on the passive node. The task status returned however is always from the active server.
- I understood get-scheduledtask only queries the server you are running the code from
- What could possibly be a reason why the code run interactively but not from the service? (The impacted services have no specific difference in set up.)
Any constructive thoughts or suggestions would be grateful received.
Just for clarity I have run the code just with get-scheduledtasks|out-file to see what it is picking up. All good interactively, but the above issue through a scheduled job.