powershell – Scheduled Task keeps running with Event Viewer ‘audit failure’ SeTcbPrivilege error

On Windows Server 2012, I’m trying to create a Scheduled Task, that runs as a Domain user, that copies a file from a different server to the local server, then deletes the file locally if the date modified is older than 30 minutes.

The powershell script I have works when I run it as my own admin account with Powershell and finishes without error.

I created the Scheduled Task and it too runs and the file is copied, and deleted if older than 30 minutes, but the task keeps running and never finishes.

The Event Log gives an Audit Failure error mentioning “SeTcbPrivilege”.

The Domain user has permission to run batch scripts.

Powershell execution policy is Unrestricted.

I’ve tried configuring the Task with different arguments, including:

-ExecutionPolicy Bypass -file "C:scriptsscript01.ps1"

The task is set to store the password, run if not logged on, with highest privileges.

What else could I be missing?

I suppose the process could be finishing but the Task Scheduler GUI just isn’t updating but in that case I’m concerned with the Audit Failure error.

I don’t think the powershell script matters but this is the gist of it:

Copy-Item -Path \server.example.comdirectoryfile.txt -Destination D:directoryfile.txt
Get-ChildItem -path D:directory | where {$_.Lastwritetime -lt (date).addminutes(-30)} | remove-item