Skip to main content
edited tags
Link
fixer1234
  • 27.6k
  • 61
  • 78
  • 123
Mod Moved Comments To Chat
Source Link

Windows Scheduled Task executes SQL scripts as Anonymous Logon, despite being associated with a domain account

I've built an EXE that I need to run every hour, for the rest of forever. To do this, I'd like to use Windows Task Scheduler.

It would be more appropriate to run this on Windows Server, but circumstances stick me with Windows 10 Enterprise (16299).

The EXE is simple enough--pertinently running a SQL query and some network calls. No big deal.

I've set up the scheduled task, and it successfully makes network calls, but it's failing on the SQL ones.

Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'.

This error makes perfect sense for a task that isn't set up correctly, except I believe I have done the necessary steps.

enter image description here

I'm logged in with that listed account and I'm able to directly run the EXE without any errors. But any time I do it through Task Scheduler (on-demand or scheduled), it fails with the above error.

I'm using Integrated Security, of course. SQL Auth isn't an option. And I do not have any control over the SQL Server directly.

This has worked for me before, but on Windows Server. I'm not sure if there's something wonky here, or if I've just missed some setup step.

To be clear, the whole task was failing to start at all initially, before I had the computer owner grant me Logon as Batch Job rights. Given it works now, after making that change, I'm 99% sure it's trying to run as that account. So what gives?

Any ideas?