我已经使用下面的Powershell脚本创建了Windows计划任务。它应该运行一次并延迟5分钟:
$action = New-ScheduledTaskAction -Execute 'powershell.exe' -Argument '-command C:\Temp\BootStrap\Boot.ps1 '
$trigger = New-ScheduledTaskTrigger -AtStartup -RandomDelay (New-TimeSpan -minutes 5)
$prncipal = New-ScheduledTaskPrincipal -UserId "Admin" -RunLevel Highest
Register-ScheduledTask -Action $action -Trigger $trigger -Principal $prncipal -TaskName "Register Octopus Tentacle"
当我运行Get-ScheduledTask cmdlet时,我看到该任务已创建并且处于“就绪”状态。但是,它永远不会运行。我在做什么错了?