[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Scheduled Task only runs when user is logged in?

Posted on 2007-08-01
19
Medium Priority
?
595 Views
Last Modified: 2010-04-21
Hi, I have a scheduled task that runs some macros in excel which make calls to a .dll, I am not 100% sure what goes on behind the scenes in the .dll but have been experiencing very strange phenomonons....

If I am logged into the machine the scheduled task runs no problem, both on the timer and if I run it via the scheduled task panel in the control panel by right clicking on the task. when I log off the machine, the the task will still run, but it crashes somewhere in the .dll and I do not know wtf is going on... I just lock the machine with my user, it all runs okay, but its when i log off that the application craps out...

the task is set to run under my username when it runs, so I am not sure why it matters that I am logged in... please help... this is all running on server 2003 with office 2000. I need to be able to get this thing to run without me having to be logged in....

thanks. Marc
0
Comment
Question by:mrferrari
19 Comments
 
LVL 9

Expert Comment

by:iCoreKC
ID: 19613255
My first thought is that the .dll file is in a directory with security limitations.  

Are you seeing anything in the Event Viewer?  If so, please post the Event ID and information.

0
 
LVL 7

Expert Comment

by:Bruce Cadiz
ID: 19613509
mrferrari,

 What you need to do is set up the task in the task scheduler to run under a system account (NT AUTHORITY\SYSTEM). Your personal account has suffiecient priviledges to run the macros / access the .dll but when you are logged off it cannot run / access the files.  NT AUTHORITY\SYSTEM should run no matter what / who is logged on/off. If you have admin rights you won't need to enter a password when creating the scheduled task.

Bruce

0
 
LVL 85

Expert Comment

by:Rory Archibald
ID: 19613524
How are you starting Excel in the task?
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

Author Comment

by:mrferrari
ID: 19619217
there is nothing being show in the event viewer. the task runs and completes, but somewhere in the code it crashes the loop stops and i get 0's written into my database instead of the actual values I am trying to generate.
0
 

Author Comment

by:mrferrari
ID: 19619231
what is the NT AUTHORITY\SYSTEM, I have tried to put this in and it still asks for a password... is it exactly "NT AUTHORITY\SYSTEM" or is mydomain\system, etc. I tried several things, all required me to put in a password.

I also tried to create the scheduled task via the cmd promot, same issue occurs as in the main questions described above.
0
 

Author Comment

by:mrferrari
ID: 19620376
got NT AUTHORITY\SYSTEM to fill in, but then the task does not even run...
0
 
LVL 7

Expert Comment

by:Bruce Cadiz
ID: 19620574
mrferrari,

To enter the NT AUTHORITY\SYSTEM you need to have Administration Rrights on the computer. You do have Admin Rights on this computer / server?

Bruce
0
 

Author Comment

by:mrferrari
ID: 19620633
bruce, i got it going, but then the task didnt even run... im still buggered at the moment... not sure if the dll is screwing me up or the specified user the task is running as is not working properly... thx Marc
0
 
LVL 7

Expert Comment

by:Bruce Cadiz
ID: 19620676
Mark,

Try this, create another simpler task say a command file that echos some text to a file
example: "echo test file > test.txt" then save as a test.cmd file.
Put it in the scheduler, set it for a few minutes ahead and log out.

Then you can log back on and see if the task scheduler is executing properly. if so then you can be sure something else is the problem.

Bruce
0
 

Author Comment

by:mrferrari
ID: 19620717
Hi Bruce, I know the task runs fine... b/c I get entries written into my database, but it seems that somehow the dll is checking to see if there is a user that is logged into the machine or has the machine locked. in that situation it all run fine, if no user is logged in or I end the remote connection to the server, the one piece of code in the dll fails and then returns to me a 0... its something in the dll, but I thought that using run as tell s the computer to use the account specified. clearly there is still some parameter left out and it knows noone is actually logged onto the machine. perhaps its some sort of connection its looking for... thx for the help.
Marc
0
 
LVL 7

Expert Comment

by:Bruce Cadiz
ID: 19621394
Marc,

What exactly is the code you wrote and .dll soing? Perhaps is it connection to an MS SQL database and pulling data and authenticating via the logged in user? That would be the thing that makes sense based on what you've described.

Bruce
0
 

Author Comment

by:mrferrari
ID: 19621431
thx for the comment... the code runs some simulations and it runs on lots of computers so it must not know who is logged in nor care, but it seems that it requires a user to be logged in. ive tried everything. the code in the dll stops running and exits the function when noone is connected to the machine... I need to figure out how to trick or something...

thx, Marc
0
 
LVL 7

Expert Comment

by:Bruce Cadiz
ID: 19621562
Marc,

 Is this a custom .dll you / some has written or something from Microsoft/another company? What is it doing exactly?

Bruce
0
 

Author Comment

by:mrferrari
ID: 19621646
this is dll that came to me from a third party vendor that I do not want to name on the forum, I open excel and pull in data from my database. it then runs some more code and calls a "dll" file that I have on the machine and goes through a monte carlo simulation of 5,000,000 trials. but when not logged in it only runs one trial and returns a 0 instead of the actual computation... Im not sure what its exactly doing or where it is exactly crashing... it just appears that the server is not running the code identically as though the user is logged into the box... thanks for any help. im really buggers stuck on this one. Marc
0
 

Author Comment

by:mrferrari
ID: 19621681
I could send you the file and dll if you would like... but not sure if that would help... seems like in the dll its looking for the logged on user but I cannot tell... thx again for even taking the time to think about this with me... Marc
0
 
LVL 7

Accepted Solution

by:
Bruce Cadiz earned 2000 total points
ID: 19621737
Marc,

 I would suggest contacting the 3rd party vendor tech support to understand what is happening. Also you can try something like Dependeancy Walker to see what the .dll is dependent on and maybe you can see something significant. http://www.dependencywalker.com/
Also perhaps you can find some VBA code that will elimate the need for the .dll
http://www.anthony-vba.kefra.com/vba/vba12.htm


Bruce
0
 

Author Comment

by:mrferrari
ID: 19648672
I finally decided to run the script using my local machines scheduled task manager. I usually lock my PC overnight and the scripts work fine when the machine is locked. On the server I could not be sure I would stay logged in b/c system admin could go into the machine and then logoff... this was the best I could do.
0
 

Author Comment

by:mrferrari
ID: 19648680
Please close questions, I would like to award c336914 the 500 points for helping, but his answer was not the utilized solution. Is that possible?
0
 

Author Closing Comment

by:mrferrari
ID: 31407575
thx
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

872 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question