Windows Scheduled Tasks and Permissions

Here's my construct:
1. I created a BAT file named EXEC_spRTMaster.bat that calls a SQL Server command named SQLCMD (which in turn runs a sproc named spRTMaster).  When called manually, the BAT file runs successfully.
2. I created a Windows Scheduled Task to call EXEC_spRTMaster.bat.  When the Windows Scheduled Task is associated with account in Domain Admins, it runs successfully.
3. I created a Domain User account named RTScheduler.  I gave RTScheduler full permissions to the Scheduled Task.  I also gave RTScheduler full permissions to the folder containing EXEC_spRTMaster.bat.  
4. Yet, when I run the Scheduled Task while its associated with RTScheduler as the user, EXEC_spRTMaster.bat does not run.

It seems like I still need to grant another permission somewhere?  Or, perhaps there's another process (associated with a different domain account) that's sneaking into the process?
Who is Participating?
stehardy88Connect With a Mentor Commented:
It's definatly a permissions issue. Does the Domain Users account you created have the correct permissions to the SQL Server?

Try giving the Domain Users account Administrative Access to the SQL Server (or Database you are running the command on) and then try again.

jdanaAuthor Commented:
I didn't give RTScheduler permissions on SQL Server because SQLCMD is run by sqlservr.exe and it's associated with the Local System account (which in turn is a member of sysadmin role on SQL Server).  It sure can't hurt, however.  I'll give it a shot.

Too many layers!
jdanaAuthor Commented:

It worked.  I'm stumped.  I still don't get why RTScheduler needed any kind of SQL permission.  Maybe if it's calling the BAT file via Windows Scheduler, it's taking over for Local System?
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.