Jump to content

NET Executable SQL Task runs fine when run manually, but not through Task Scheduler!


Recommended Posts

Posted (edited)

Our Information Services team have a small NET application which they can run to update some SQL reports, which when run on a server manually under a user account with the relevant admin permissions to everything (The server itself and the SQL connections) works absolutely fine, however when set up as a Scheduled Task reports a status of 0x0 to indicate success however we then look at the report and it hasn't updated! There isn't anything useful in Event Viewer either :(

 

This also ran fine under 2008 Task Scheduler but not 2016 just to make things more confusing! (I tried changing the 'Configure For' option to Vista/2008 but still no joy)

 

Any ideas? The config file is below with a few minor tweaks to server names etc

 


 
   
 
 
   
   
   
   
 
 
   
     
       
     
   
   
     
       
     
   
 

Edited by googlemad
Posted (edited)

Does it work fine running it manually on the 2016 one? (As you mentioned a 2008 one) Just wondering as you've specified the .NET version.

 

But what user is the scheduled task running as? Seeing it's set as integrated auth in the connection "Integrated Security=SSPI"

 

Could also be something as stupid as that profile doesn't have access via firewall etc or is this app run locally on the SQL server?

 

Steve

Edited by Steve21
  • Thanks 1
Posted

Yes, it is the same executable on both Windows 2008 and Windows 2016 servers - When run manually (log in to Windows and double click the executable) under the user account set up to run the task it runs as expected.

 

As I say the user has relevant permissions to everything - but you have just reminded me that I forgot to point out the Scheduled Task DOES work running under the domain administrator account which suggests permissions somewhere but 0x0 is throwing me!

Posted

The 0x0 is just a return code from the program though. If you didn't put any error checking into the .NET exe to return if it can't connect etc then it's still "run fine" even with not connecting etc.

 

What happens if you log in with that user and run the scheduled task manually (not via the actual exe)

 

Steve

  • Thanks 1
Posted

Thanks for your help but it turned out to be much more simple in that the database was actually on a test SQL server I had no idea existed :doh: Once I fired up the SQL logs on that I could see a ton of denied access messages for the service user set up to run the tasks, once added as a SQL sysadmin login data is flowing fine.

 

Still doesn't explain why on earth the task seemed to run fine manually before when executed manually by the user account but maybe they were just getting confused - I certainly am! (But at the same time not too fussed as long as it is working!)

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...