Link to home
Start Free TrialLog in
Avatar of DWStovall
DWStovallFlag for United States of America

asked on

Scheduled Task won't launch .bat or .vbs

I can't get GPO-based Scheduled Task to launch .bat or .vbs on Windows7 client machine.

We have Sever2008 domain controllers - I'm using typical GPO settings (Computer -> Preferences -> Control Panel -> Scheduled Tasks) to set a task to run under "System" authority.  I've tried making it launch .bat and .vbs files, and it won't do either.  These are very basic (helloworld.bat and msgbox.vbs - have been scripting for years).  

After reboot, I go into "Scheduled Tasks" on the client and I see the task.  It kicks off at the appropriate time, and it shows "The task is currently running (0x41301)" - however, it never actually launches the batch file or the script (I've tried a variety of versions - either trying to run a .bat or a .vbs (vbs running under wscript.exe).  I never get the response I expect to see (a popup box showing "Hello World") to indicate that the script/batch file is actually running.

Thanks...DavidS
Avatar of Steve
Steve
Flag of United Kingdom of Great Britain and Northern Ireland image

So the scheduled task is applied to the PC, it just doesnt work. is that correct?
What location have you specified for the batch file? is it on a server share on on the PCs?
Avatar of DWStovall

ASKER

Created a GPO which includes settings (path in previous mesage) to create a Scheduled Task to run under System authority.  RSOP shows that the policy applied, the Task Scheduler Library on the client machine shows the task.  The task is set to run a "hello.bat" from the C:\ root.  The hello.bat is on the client's C:\ root.  The hello.bat runs perfectly (very simple HelloWorld popup) when I launch it manually on the client machine either by double-clicking it in a standard window or launching it as a command line from a prompt - the batch file runs just fine.  The scheduled task (created by the GPO) launches at the prescribed time, the "Status" shows that it is "Running", the history (in the Task Scheduler shows all the expected steps (Task Registered, Task Triggered, Task Started, Action Started, etc), but it never actually runs the script.  I've checked and double checked all the security settings for the batch file, and everything should work.  It's as if there is a Security Policy setting to not launch .bat or .vbs from a Scheduled Tasks.  I've been working on this for days.  My next step is to repair/rebuild the client.
ASKER CERTIFIED SOLUTION
Avatar of Don
Don
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
ah, yes. you've set it to run as system. this will not interact with the desktop, although I think there may be a setting you can change that will enable desktop interaction.
I disagree...it wasn't a solution.  I had already tried the solution by dstewartjr.  
Having a hard time believing that
I believe this is a result of improper group policy settings.  We've since abandoned the approach.  I am not opposed to awarding the points as suggested, but the solution was not a solution and should not be designated as one - it would be misleading.

I apologize for not responding to the posts.  I will try to be more responsive in the future.

Thank you...
Sorry, but I disagree

"Created a GPO which includes settings (path in previous mesage) to create a Scheduled Task to run under System authority. "


A scheduled task that runs under the "System" context will *Not* be visible to the logged on user. Nothing to do with Group Policy.

My answer was posted on prior experience with this issue.

In fact the only way I've found to get a task to run interactively as another user is to use "AT"

http://support.microsoft.com/kb/313565

The first link provided does not tell us anything about the issue at hand - it is a description of general task properties, and some account restrictions, but nothing regarding interaction with the desktop.

The AT link does not work on Vista and later anymore as described. AT always runs with SYSTEM account, and ignores the "/interactive" switch (SYSTEM cannot interact with the user desktop, as correctly stated).

However, if you start tools like msg.exe for sending popups, that works in all variations, even when called from a batch file.

The only way to get an interactive cmd prompt is by having the job run under the current login credentials, and with the setting "Run only when user is logged on".
There are several reasons we could suggest as the cause:

Improper GPO settings
Issues with WIN7 and interactive 'System' processes
Batchfile errors

Without establishing which, I think it's probably best to delete the question and drop it.
It sucks to participate without getting points for your work but we cannot profess to have provided the solution as the asker dropped the issue without success.
I recommend closing the ticket and starting over.  I will do more research to better determine the condition under which the task was not working.  I will then be able to better document the case and resubmit.  

I apologize for the submitting the question and creating such a mess.

DavidS
It wasn't a complete solution - only pointed in the general direction.