0

I am using Windows Server 2012 and I try to schedule a task with Windows Scheduler to run an .exe Delphi program. This program writes some data into an Excel form. When the user of the Server is logged in everything works fine. But if the uses is logged out then the task is stuck. So I am guessing there is some issue the users?

The error I receive is:

server execution failed

The setting in the task scheduler is to run even without the user logged on

Has anyone encountered some similar problem?

I am thinking of implementing a CLR-Assembly to write the data on the excel but I am afraid of the performance overload that will be caused. What would be the best-practice of a scenario like this?

GuidoG
  • 11,359
  • 6
  • 44
  • 79
Manos
  • 77
  • 1
  • 10
  • what does this question has to do with sql-server ? – GuidoG Mar 08 '18 at 15:05
  • @GuidoG Not much really, just the data are fetched from SQL-Server. Thought it would be better to give the whole system – Manos Mar 08 '18 at 15:08
  • what happens if you log in as another user and then start this application ? – GuidoG Mar 08 '18 at 15:10
  • @GuidoG whenever a user is logged in everything works fine. If no user is logged in then it stacks. – Manos Mar 08 '18 at 15:13
  • if you are opening excel during the task, it will need a GUI session... – whosrdaddy Mar 08 '18 at 16:57
  • Implement detailed logging in the delphi program, so you find out exactly where the execution fails. – Jan Lauridsen Mar 08 '18 at 21:08
  • @whosrdaddy If this is the case I have a big problem. I need this procedure to run regardless if the there is a user logged in. Do you have any idea how could this be made? – Manos Mar 09 '18 at 07:33
  • @JanLauridsen There is no fail. The process is stuck in running and after a while the windows throw a timeout and kill the process. My problem is why is it stuck in running the 1st place. – Manos Mar 09 '18 at 07:35
  • 1
    @Manos, since you are not showing code, I can only guess. Finding a library that can write to xls(x) files without the need of having excel would be a good start. – whosrdaddy Mar 09 '18 at 07:43
  • @whosrdaddy Thank you so much for you suggestion! I have not considerate something like this. Although, If I understand correctly this : https://stackoverflow.com/questions/2654932/create-excel-files-from-c-sharp-without-office I can make an excel without office, but in my case I would like to write on an existing excel. Will those tools work? – Manos Mar 09 '18 at 08:15
  • Yes something like https://github.com/JanKallman/EPPlus would certainly work. – whosrdaddy Mar 09 '18 at 08:40

0 Answers0