Solved

Scheduled Task hangs at status The Task is Currently Running

Posted on 2010-08-23
9
1,614 Views
Last Modified: 2012-06-21
I have set up a task to backup our TMG configuration on our 2008R2 server.  It calls a CMD file to perform the work.  The CMD file works fine standalone, or if in the task and set to run only when the user is logged on.

If I set it to run Whether the User is Logged on or Not (with credentials for an administrative account supplied, and Run With Highest Privileges checked) the task hangs with a status of The Task is Currently Running.

Any suggestions please?
0
Comment
Question by:mohegantribe
  • 4
  • 4
9 Comments
 
LVL 8

Expert Comment

by:MarkieS
ID: 33501467
Does the CMD line or file use any mapped network drives?  
Can you implement the commands in a series of Task Sequence steps along the lines of :-

CMD.EXE copy \\servername\c$\filewanted.txt  \\serverdestinantionname\c$\filewanted,.txt

Think this will need a little more detail..
0
 

Author Comment

by:mohegantribe
ID: 33501582
The task action is: cmd.exe with the argument start "TMG Backup" "c:\backup forefront.cmd"

The CMD file contents are: importexport.vbs e c:\TMGBackups\backup%date%.xml

Running the CMD manually works.
Running the task with Run only when user is logged on works
Switching the task to Run whether user is logged on or not and setting the trigger 2 minutes out (won't run interractively) hangs status Task is currently running.
0
 
LVL 8

Expert Comment

by:MarkieS
ID: 33501682
It sounds like a batch file hang problem where the batch file is still running, waiting for some input, but SCCM cant tell what is happening with it until it finishes and gives an exit code.

As far as SCCM is concerned it has launched the command line and then lets the batchfile or vbs script get on with it.
This works fine when you are logged in as your enviroment variables such as %APPDATA%  %TEMP% etc etc are available for SCCM to use.

The batch file may error and is awaiting input or clarification.

You may have to specify fuller path details in your command lines to access what you are trying to run...

For example
The CMD file contents are: C:\WINDOWS\importexport.vbs e c:\TMGBackups\backup%date%.xml
0
 
LVL 7

Expert Comment

by:celazkon
ID: 33502112
I had quite similar issue when running the powershell script as a scheduled task. In my case the problem was security-related, after I explicitly stated to run the task as user Administrator, it started working as expected. Even when my account was member of administrators group, it simply didn't run the script correctly. Since this solved the issue for me, I didn't waste time with finding out the specific reason for this behavior.
Hope it can help you.
0
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 

Author Comment

by:mohegantribe
ID: 33502368
Markie

SCCM doesn't come into play here.
Even editing the path didn't help.  Still hung at running task
Contents of batch now:   c:\importexport.vbs e c:\TMGBackups\backup%date%.xml


Celazkon

Changing to local Administrator didn't help.  Still hung at running task
0
 
LVL 8

Expert Comment

by:MarkieS
ID: 33502521
So just a plain Scheduled Task - sorry to get wire's crossed!

Content of CMD file :-

Your line - importexport.vbs e c:\TMGBackups\backup%date%.xml

Should that be importexport.vbs e "c:\TMGBackups\backup date.xml" with quotes?

Does your VBS or XML files refer to any paths that could be misinterpreted or need quotes around it for long file names.
0
 

Accepted Solution

by:
mohegantribe earned 0 total points
ID: 33502548
I ended up calling the batch directly.

My initial testing was using my own account to verify whether it worked.  Switched user to a non-expiring password user for final task setting.

I found that the short date settings I'd set were for my logon only, and not the logon for the user I set the task to run with, and the "/" in the date hosed the works.

Setting the short date to use a "-" for the task user resolved.
0
 
LVL 8

Expert Comment

by:MarkieS
ID: 33502599
Nice one - well done..
0
 

Author Comment

by:mohegantribe
ID: 33503330
solved
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

My purpose is to describe the basic concepts of virtual memory as implemented in a modern Windows-based operating system. I will also describe the problems inherent in older systems and how virtual memory solves them. The dark ages - before virtu…
This is a little timesaver I have been using for setting up Microsoft Small Business Server (SBS) in the simplest possible way. It may not be appropriate for every customer. However, when you get a situation where the person who owns the server is i…
In this video, we discuss why the need for additional vertical screen space has become more important in recent years, namely, due to the transition in the marketplace of 4x3 computer screens to 16x9 and 16x10 screens (so-called widescreen format). …
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…

760 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

17 Experts available now in Live!

Get 1:1 Help Now