0
votes

I've created a PowerShell script which lists the scheduled tasks and the LastRunResult. I'm using Get-ScheduledTask command. I need to put it at the end of every scheduled task to send a notification related to the LastRunResult.

The problem is that Get-ScheduledTask command doesn't work properly and do not show ALL scheduled tasks but just some of them. To be able to see all scheduled tasks the Get-ScheduledTask command needs to be run from the CMD or PowerShell console with administrative privileges. And it works from there. But it doesn't work when I run such script from Task Scheduler. Checking Run with highest privileges doesn't work. Specifying Policy -Bypass doesn't work as well.

Does anyone know how to execute Get-ScheduledTask from Task Scheduler ran in administrator mode to list all scheduled tasks?

1

1 Answers

1
votes

This can be caused if you have UAC enabled or are logged on as a user who is not an administrator. Ensure the runas account is a local administrator.