Scheduled Task Access denied when writing to Network Share
I created a PowerShell script that runs scheduled under serviceaccount credentials. When executing the task I got an access denied. Investigating the problem I noticed that the Do not store password. The task will only have access to local computer resources checkbox was enabled. With this box enabled you cannot perform remote tasks (including writing to network shares).
Enabling this checkbox I ran into the next error:
An error has occurred for task task_name. Error message: The following error was reported: A specified logon session does not exist. It may already have been terminated..
This error occures when the following policy has been enabled:
Computer Configuration\Windows Settings\Security Settings\Local Policies\Security Options
Network Access: Do not allow storage of passwords and credentials for network authentication
It’s best to leave this policy enabled. However if you have a situation that requires writing to the network from a scheduled task you need to disable this policy.