In Windows 2012 (myServer1), I have a scheduled taks (myTask) running as myDomain\user1. I can manually run it any time in addition it runs as scheduled.
After myServer1 was upgraded directly to 2019, myTask still runs successfully as scheduled, but when I run it manually, it failed with error message:
The user account does not have permission to run this task.
I tried the following command to assign permission to user1
$taskPath = ""
$taskName = “myTask”
$principal = New-ScheduledTaskPrincipal -UserId “myDomain\user1” -LogonType ServiceAccount
Set-ScheduledTask -TaskPath $taskPath -TaskName $taskName -Principal $principal
The following command show user1 has READ permission
icacls C:\Windows\System32\Tasks\myTask
C:\Windows\System32\Tasks\myTask myDoamin\user1:(R)
BUILTIN\Administrators:(I)(R,W,D,WDAC,WO)
NT AUTHORITY\SYSTEM:(I)(R,W,D,WDAC,WO)
BUILTIN\Administrators:(I)(F)
But when I manually run it, it still failed with same error.
Please help.
Thanks,