Weekly tasks created via PowerShell using a different user immediately fail with error 0x41306 - by DanTup

Status : 


Sign in
to vote
ID 776801 Comments
Status Active Workarounds
Type Bug Repros 6
Opened 1/17/2013 8:22:55 AM
Access Restriction Public


(Edit: Confirmed that this happens on Windows Server 2008 R2, Windows Server 2012, Windows 8)

I've posted full details and a sample on StackOverflow here:


We're using PowerShell to create some scheduled jobs, but those that are set to be weekly instead of daily (using New-JobTrigger) always immediately fail with an exist code of 0x41306 when we try to execute them from the Task Scheduler UI. (However they seem to work in PowerShell if we use (Get-ScheduledJob x).Run()

In the repo steps is a script to create two identical tasks; one running daily, one weekly. Forcing them in the Task Scheduler UI will show this issue (one will run and have exit code of 0, the other 0x41306).

We're using Windows Server 2008 R2. Jeff Hicks has tested this on Windows 8 and says the same thing occurs there. If we don't pass the -Credential to it, it doesn't seem to happen.

Some additional info from Jeff Hicks:

I used your code to create the same jobs on my 2008 R2 box running PS v3. Both jobs ran fine from PowerShell using Start-Job. But in the GUI, I got the same error for the weekly job.

I get the same result on Windows 8. Something is telling the task service to abort. I tested some other settings but they had no effect. I looked through all of the logs I could think of and all they show is the job starting, PowerShell loading and then the task scheduler cancelling.

I reset the weekly task to run today a little bit ago and it still failed. I also tested a weekly task doing something other than PowerShell and it ran just fine.

I changed the weekly job to use the same account as the current user and it ran just fine. Changed it back to the other account and it failed again. I have no idea about the correlation between the trigger and account.
Sign in to post a comment.