I have a problem with PowerShell script in Tasks Sheduler in Windows Server 2008 R2. I try to run Sheduler Tasks which run batch file which run PowerShell script to Backup Farm and while I choose "Run only when user is logged on" script is working well but when I choose "Run wherther user i slogged on or not" script doesn't work and in Event Viewer I see Event 3351 which say below that Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'

Where is problem? Mayby I should add other user to SharePoint Shell Access?

I use SharePoint Foundarion, SQL Server 2008 and Windows Server 2008 R2

1 Answer 1


Here is what you should do:

  • Run the task under designated service account e.g. CONTOSO\sp_powershell
  • The account needs to have proper privilages, it needs SharePoint Shell Access (check Add-SPShellAdmin for more details)
  • Thanks a lot for your advice :) I will inform about progess in my case.
    – Wilon
    Oct 22, 2012 at 14:57
  • It doesn't work for me, I created service account for run PowerShell Backup script in Tasks Sheduler and add that account to SharePoint Shell Access and nothing is changed. Should I add this account to every database? I ask because I added only to Config database?
    – Wilon
    Oct 23, 2012 at 7:59
  • If you are trying to backup your Content databases then yes, it should have. If you are still having problems try to run PowerShell Shell as a different user (CONTOSO\sp_powershell) and troubleshoot permissions. Oct 23, 2012 at 9:06
  • I found solution for my case, I select "Run whether user is logged on or not" , "Run with highest privileges", "Hidden" and I didn't select "do not store password. The tasks will only have access to local resources" but to do this first I had to change Registry key HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Lsa disabledomaincreds from 1 to 0 because earlier I can't do this. I saw Error message 2147943712. Now my Task is working good while I'm logon and while I'm logout.
    – Wilon
    Oct 24, 2012 at 11:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.