Solved

Scheduled Task won't launch .bat or .vbs

Posted on 2011-03-08
16
4,548 Views
Last Modified: 2012-05-11
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
0
Comment
Question by:DWStovall
  • 5
  • 3
  • 3
  • +1
16 Comments
 
LVL 27

Expert Comment

by:Steve
ID: 35071922
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?
0
 

Author Comment

by:DWStovall
ID: 35072156
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.
0
 
LVL 47

Accepted Solution

by:
Donald Stewart earned 500 total points
ID: 35072953
This is because the task is running under the context of "System" and not of the user that's logged in

read here

http://technet.microsoft.com/en-us/library/cc722152.aspx
0
 
LVL 27

Expert Comment

by:Steve
ID: 35100011
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.
0
 

Author Comment

by:DWStovall
ID: 35360059
I disagree...it wasn't a solution.  I had already tried the solution by dstewartjr.  
0
 
LVL 47

Expert Comment

by:Donald Stewart
ID: 35360077
Having a hard time believing that
0
 

Author Comment

by:DWStovall
ID: 35360090
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...
0
 
LVL 47

Expert Comment

by:Donald Stewart
ID: 35360124
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

0
 
LVL 68

Expert Comment

by:Qlemo
ID: 35361261
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".
0
 
LVL 27

Expert Comment

by:Steve
ID: 35366333
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.
0
 

Author Comment

by:DWStovall
ID: 35379551
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
0
 

Author Closing Comment

by:DWStovall
ID: 35393935
It wasn't a complete solution - only pointed in the general direction.
0

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Migrate 2008 DNS server to Windows 2012 RS 8 36
active directory 3 27
Active Directory Problem 4 28
active directory 1 11
Today, still in the boom of Apple, PC's and products, nearly 50% of the computer users use Windows as graphical operating systems. If you are among those users who love windows, but are grappling to keep the system's hard drive optimized, then you s…
Synchronize a new Active Directory domain with an existing Office 365 tenant
This Micro Tutorial will give you a introduction in two parts how to utilize Windows Live Movie Maker to its maximum capability. This will be demonstrated using Windows Live Movie Maker on Windows 7 operating system.
This Micro Tutorial will give you a basic overview of Windows Live Photo Gallery and show you various editing filters and touches to photos you can apply. This will be demonstrated using Windows Live Photo Gallery on Windows 7 operating system.

743 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now