[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1710
  • Last Modified:

Scheduled Task hangs at status The Task is Currently Running

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
mohegantribe
Asked:
mohegantribe
  • 4
  • 4
1 Solution
 
MarkieSCommented:
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
 
mohegantribeAuthor Commented:
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
 
MarkieSCommented:
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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
celazkonCommented:
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
 
mohegantribeAuthor Commented:
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
 
MarkieSCommented:
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
 
mohegantribeAuthor Commented:
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
 
MarkieSCommented:
Nice one - well done..
0
 
mohegantribeAuthor Commented:
solved
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

  • 4
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now