Link to home
Start Free TrialLog in
Avatar of troyComp14
troyComp14

asked on

Windows 2008 R2 - Schedule task not Running when logged off

Hi, We have the following environment

Windows 2008 R2 Server fully patched Terminal Server
Logging in as Domain admins

Issue:
Unable to run vb application via task schedule when set to run when either logged off or locked

Tests:
Ran schedule task to open notepad and notepad opens when you set the task to run only when logged on.

When we run the same task to open notepad but set to run when either logged off or locked  it doesn't open notepad but you can see the notepad.exe running in task manager.

So, I believe if wen can get notpad to open when the schedule task properties are set to run when logged off this will fix the issue with or vb program.

My hunch is it has something to do with Group policy or Security settings.  Even then the task is running as domain administrator and we are logged in as the domain administrator.

I have also tested on a windows 8 machine that is not part of the domain and the same issues occur

Cheers,
Troy
Avatar of BurundiLapp
BurundiLapp
Flag of United Kingdom of Great Britain and Northern Ireland image

From what you're saying it sounds like notepad.exe does run but you don't see the notepad window popping up, is that right as this is what I would expect if you are not logged in or the screen is locked, notepad is a program that requires user interaction so it requires an active desktop to display on.

Bringing up notepad is not a normal use for task scheduling, you would normally use it to perform maintenance tasks in the background that require no user interaction so this behaviour is normal.

What parameters in the run and startup fields are you using to launch the vb app?  I presume the VB app doesn't present any screens requiring user interaction when it is running as that would make it unsuitable for scheduling.

Does the vb app run fine from a command line on the same server?

Have you ticked the 'run whether user is logged on or not' tick box on the scheduled task?
Avatar of troyComp14
troyComp14

ASKER

All the testing is done when I am logged on viewing the screen and running the scheduled task manually.

We have this program on a number of servers and I am only aware of the issue on 2008 server.

The VB program has a /noui agrument which means no user interface is presented.  When we are testing we remove this argument to ensure the program actually opens up requiring user interaction so we can see if the task schedule is working probably.  On this particular server it doesn't happen, so we came up with the test from other forums to try and open up notepad from a schedule task to ensure it isn't the VB program.

To recap:
1) I am logged on the server as the domain administrator
2) I ran the task MANUALLY with the 'run whether user is logged on or not' tick box CHECKED.  Notepad doesn't launch
3) I run the task again with the "run whether user is logged on or no" tick box UNCHECKED
and Notpad Launches.

So I believe point 2) should work as I am logged on therefore notepad should lauch
In the scheduled task
under the Actions tab
select edit
In the field "Start in (Optional) - enter the location (folder) where the script sits that you are running

I has simuliar issue pulling info from an AD group and creating a txt file with that info.
Worked when launched manually but not from the scheduled task until I did the above.
Avatar of McKnife
Hi.

As said before: normal behavior. You are storing a password, so imagine the following scenario: someone else is logged on and the task starts notepad interactively (=visible)... this would enable that someone to act as another user... good-bye, security!
That's why notepad does not show up - it runs non-interactive for securiry reasons.
We still haven't been able to resolve the issue.

We have this application installed on hundreds of servers and it only seems to be an issue on 2008R2
Name one OS that displays it, please.
I think we are getting away from the real issue which is the VB app is not working when the OP tries to run it as a scheduled task.  Lets forget about notepad not running and concentrate on the VB app.

Does wscript or cscript run at all when the scheduled task for the VB app runs?

Does it generate a failure error in the scheduled tasks manager, if so what is the code it is generating?
ASKER CERTIFIED SOLUTION
Avatar of Mike Schultz
Mike Schultz
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial