Solved

Scheduled Task hangs at status The Task is Currently Running

Posted on 2010-08-23
9
1,621 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Many times while working on a computer regardless of any Operating System, lag and crashes seem to creep in, hindering your working speed. Sometimes, it can also cause your work to be lost unexpectedly and as a result, you are unable to meet your de…
This article covers how to install the Microsoft Windows Operating System (OS). What is covered in this article:  > Different Versions and Editions of the Windows OS  > Upgrading versus Fresh Installation of the OS           - Steps to take pr…
Windows 8 comes with a dramatically different user interface known as Metro. Notably missing from the new interface is a Start button and Start Menu. Many users do not like it, much preferring the interface of earlier versions — Windows 7, Windows X…
Windows 8 came with a dramatically different user interface known as Metro. Notably missing from that interface was a Start button and Start Menu. Microsoft responded to negative user feedback of the Metro interface, bringing back the Start button a…

937 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

1 Experts available now in Live!

Get 1:1 Help Now