How to set up a scheduled task running as a managed service account
I tried to do this both in the GUI and in powershell, but whatever I did I couldn’t get past the GUI asking for a password, or this error when I ran the task
Task Scheduler did not launch task "\matttesting" because user "chelseafc.co.uk\msa$" was not logged on when the launching conditions were met. User Action: Ensure user is logged on or change the task definition to allow launching when user is logged off.
The solution to this problem was to use the old schtasks executable.
schtasks /create /TN 'matt testing using schtasks' /SC DAILY /ST 16:45 /RU 'chelseafc.co.uk\msa$' /RP '' /TR C:\temp\matt_testing.bat /RL Highest
Please enter the run as password for chelseafc.co.uk\msa$: