mohegantribe
asked on
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?
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?
ASKER
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.
The CMD file contents are: importexport.vbs e c:\TMGBackups\backup%date%
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.
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.vb s e c:\TMGBackups\backup%date% .xml
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.vb
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.
Hope it can help you.
ASKER
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
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%
Celazkon
Changing to local Administrator didn't help. Still hung at running task
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.
Content of CMD file :-
Your line - importexport.vbs e c:\TMGBackups\backup%date%
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.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Nice one - well done..
ASKER
solved
Can you implement the commands in a series of Task Sequence steps along the lines of :-
CMD.EXE copy \\servername\c$\filewanted
Think this will need a little more detail..