Link to home
Start Free TrialLog in
Avatar of Rita Byrne
Rita ByrneFlag for Ireland

asked on

Scheduled Task Windows Server 2008 R2 hung in "running" state, status (0x41301)

Hi

I am trying to get a scheduled task to run on a schedule on Windows Server 2008 R2 OS and it keeps hanging in the "running" state without ever completing. The task calls a batch file in command prompt to connect to a remote server using psftp.

This batch file runs fine when it is executed manually under the user credentials,but for some reason it never completes when added to a scheduled task.

In the "Last Run Result" field there is a status of (0x41301)
This task has been set up with the following details from each tab:

General Tab:
set up to run with a domain account with local admin permissions on the server
set to run whether or not a user is logged on
Do not store password is not checked
Run with highest privileges is checked

Triggers Tab:
Set to run Monday, Tuesday, Wednesday, Thursday, Friday of each week

Actions Tab:
Start a program located on the D: drive ( a windows bat file that calls psftp) psftp.exe file is located in the same directory on the D: drive as the bat file
The fields "Add arguments" and "Start in" are blank

Conditions Tab:
Power - Start the task only if computer is on AC power - checked
Stop if computer switches to battery power - checked

Settings Tab:
Allow task to be run on demand - checked
Stop the task if it runs for longer than 3 days
If the running task does not end when requested force it to stop - checked

The domain account that the task runs under has full control (is a local admin on server) of the drive and folders containing the exes and bat files so it shouldn't be a permissions issue either. The log for the task only tells me the task commenced but no more information is provided.
ASKER CERTIFIED SOLUTION
Avatar of vin_shooter
vin_shooter

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Haresh Nikumbh
can you export task in xml and attached here.
Avatar of Rita Byrne

ASKER

Hi,
thanks for the suggestions, I have added the account to the Log on as a batch job role and that didn't fix the issue; I still had the same "running" state on the task.

I have since added the path C:\users\%username\desktop into start in and that didn't resolve it either. I copied all of the directories containing the task files onto the C:\users\%username%\desktop but it didn't run properly following this either.

The account running the task is a local administrator on the server. I have now also added the account explicitly to the ACL on the folder containing the exes and bat files but the task hung while "running" again.

I have logged on to the server as the domain user set to run the task and that won't run either. No information in the task history unfortunately...
Avatar of vin_shooter
vin_shooter

Login to the remote server in which the task initiates psftp.exe, check for session in that server by executing quser command for the USED ID configured in the scheduled task.

If it exists kill the session and run the task again.

Check for any error if it fails

share the results..,
Hi
I manually executed the task again and psftp.exe*32 is showing in process list, the task is listed as running.
When I execute quser <username> it just responds with "No user exists for <username>"
The psftp.exe process is still executing and using 1,288k of memory;but task is in state running and status is (0x41301)
All aspects covered by solution, the problem appeared to be the fact that start in path was not correctly populated. Also the exe file was copied into the path where the task runs the batch as suggested. Thanks for the help
hi itwex,

may i know how did u resolve the issue as i also facing the same issue with the windows 2012 server. The task scheduler shows running but nothing happens.
Hi yuschang, I resolved the issue by a process of elimination:

I had to specify the D:\..\ folder in start-in path - this was where all related files to the task are stored.

I also had to copy the exe file into the directory too, the task seemed to have an issue with running files outside of the start-in path.
HI itwex,

Many thanks for your reply.

I had specify the folder path in start-path since beginning but it was just the same.

What do u mean by "copy the exe file into the directory"

Is it copy the batch script into C:\ ?

Thanks
Hi Yuschang
The batch file was calling an exe, so all I did was copy the batch file and the exe it was calling into the same directory, the server had a few partitions, in this instance I was running from a D: partition

I made sure the permissions were ok on this directory for the user running the task (test this, log on as the user to server and try executing the batch file)
Hope this helps
Hi itwex,

I have just resolved the issue by logging in to the server with the user id and disconnect it without logging out.

Thanks for your kind help
Hi yuschang, glad you got your issue resolved