• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1164
  • Last Modified:

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?
  • 2
1 Solution
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?

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now