Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Scheduled Task won't launch .bat or .vbs

Posted on 2011-03-08
16
Medium Priority
?
4,737 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 1500 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
Learn Veeam advantages over legacy backup

Every day, more and more legacy backup customers switch to Veeam. Technologies designed for the client-server era cannot restore any IT service running in the hybrid cloud within seconds. Learn top Veeam advantages over legacy backup and get Veeam for the price of your renewal

 
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 71

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

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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

This article provides a convenient collection of links to Microsoft provided Security Patches for operating systems that have reached their End of Life support cycle. Included operating systems covered by this article are Windows XP,  Windows Server…
Compliance and data security require steps be taken to prevent unauthorized users from copying data.  Here's one method to prevent data theft via USB drives (and writable optical media).
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
Suggested Courses

604 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