GetScheduled-Job 没有 return 任何工作

GetScheduled-Job doesn't return any job

我正在尝试使用 PowerShell 向现有计划任务添加触发器。 我正在使用 Windows 10 和 PowerShell 5

当我运行:

Get-Scheduled-Job -Name TASK_NAME

我收到错误:

>Get-ScheduledJob : A scheduled job definition with Name sanityInstaller could not be found.
At line:1 char:1
+ Get-ScheduledJob sanityInstaller
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (:) [Get-ScheduledJob], RuntimeException
    + FullyQualifiedErrorId : ScheduledJobDefinitionNotFoundByName,Microsoft.PowerShell.ScheduledJob.GetScheduledJobCommand

似乎即使我 运行 没有参数的相同命令,它也应该 return 所有作业,但它 return 是一个空结果。

在 Task Scheduler 中没有 /Microsoft/Windows/PowerShell/ScheduledJobs 这样的文件夹,甚至在我创建它并且里面有一个新任务之后也没有 return 它。

我在这里错过了什么?

Get-ScheduledJob gets only scheduled jobs that are created by the current user using the Register-ScheduledJob cmdlet.

Source.

您正在查找 Get-ScheduledTask cmdlet。