Link to home
Start Free TrialLog in
Avatar of Reece
ReeceFlag for Australia

asked on

batch file scheduled task won't run

I have a batch file used to remove and remap shared network drives.
I've set up a scheduled task to run the script at 6pm daily and every hour for 23 hours.

The task is set to run with the domain user account credentials (which are a network admin and local admin), and the folder the batch file lives in (C:\scripts) and the batch file itself have FULL permissions for the same account.

The script runs by itself, but the scheduled task won't run....

What is going on?????
Avatar of Computer-Service-St-Louis
Computer-Service-St-Louis
Flag of United States of America image

Look inside eventviewer or the Task Scheduler and try to find the 0x0 code that winodws kicks out. This will tell you a lot. Post it here or google it and it should tell you exactly what the issue is. My guess would be that there is a parameter inside the scheduled task that may be triggered that prevents this from runnig, try creating a new task with the same batch file, and see if it runs, or edit the current task and have it run a different command. This will tell you if the issue is with the batch file or the scheduled task settings. Hope this helps!
Avatar of Reece

ASKER

User generated image
Avatar of Reece

ASKER

nothing shows in the even viewer under System or Application
Avatar of Reece

ASKER

the SchedLgU.txt shows:  

"Logon(all).job" (Logon(all).bat)
      Started 28/10/2011 11:51:13 AM
"Logon(all).job" (Logon(all).bat)
      Finished 28/10/2011 11:51:13 AM
      Result: The task completed with an exit code of (1).
The batch file does appear to be running.  Please post the batch file itself, if you would like us to take a look at it.  Also, you may want to modify the batch file to log to a file so you can tell for sure whether or not it is being triggered:

time /t >> c:\mybatchfile.log
SOLUTION
Avatar of sjklein42
sjklein42
Flag of United States of America image

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
I'd be glad to help.

I am a bit confused with this all.

You quote: (which are a network admin and local admin)
A local admin account have nothing to do with a network admin account (assuming you mean "network admin" = a "domain admin" account). Please confirm.

You quote: The script runs by itself, but the scheduled task won't run....
Won't run...? Task scheduler or your batch file"?

Like sjklein42 suggested, posting your batch file (by changing security infos), will help us a lot helping you.

Cheers,
Rene

Avatar of Reece

ASKER

this be my batch file:
 
@echo off

Net Use Z: /Delete /y
Net Use Z: \\192.168.1.252\Conveyancing /y

Net Use Y: /Delete /y
Net Use Y: \\192.168.1.252\Litigation1 /y

Net Use X: /Delete /y
Net Use X: \\192.168.1.252\Litigation2 /y

Net Use W: /Delete /y
Net Use W: \\192.168.1.252\Litigation3 /y

Net Use V: /Delete /y
Net Use V: \\192.168.1.252\Litigation4 /y

Net Use U: /Delete /y
Net Use U: \\192.168.1.252\Litigation5 /y

Net Use T: /Delete /y
Net Use T: \\192.168.1.252\Litigation6 /y

Net Use S: /Delete /y
Net Use S: \\192.168.1.252\MISC /y

Net Use R: /Delete /y
Net Use R: \\192.168.1.252\Admin /y

Net Use L: /Delete /y
Net Use L: \\192.168.1.252\Locus /y

Net Use I: /Delete /y
Net Use I: \\192.168.1.252\IT_ADMIN /y

Open in new window


By network admin I mean domain administrator credentials.
The scheduled task runs at the appointed times, and the script runs (when double-clicked), but the script doesn't run properly when called by the scheduled task... I can see the command prompt window appear for a second, then it disappears and the network drives aren't recreated.
SOLUTION
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 Reece

ASKER

I am using the domain account used to log on to this PC to run the scheduled task - not a local account.
I set up the log file and the output when run manually is this:  batlog.log

It initially came up with different result in the log file, so deleted the scheduled task and recreated it.
I think the issue was something to due with the timing schedule I had.  It is working now.

On another note...  Why does the command "shutdown -s -t 600" just repeat itself continuously with no action if placed in a batch file (so I can schedule a shutdown each night)???  
Avatar of Reece

ASKER

been off sick for the last week...

Any ideas how I can create a scheduled task the the shutdown -s command in a batch file?
see my above post.

cheers
You mean create a sched task to run a batch file, or to create the sched task by using a batch file?
Avatar of Reece

ASKER

Thanks for getting back to this problem ReneGe...

I can create the scheduled task to run a batch file.  I don't know how to use a batch file to create a scheduled task, but I don't think that's what I need here...
It's more that the shutdown.bat file I have doesn't work.  I must be missing something.

The command "shutdown -s -t 60" works fine using the command prompt, but when I save it into a batch file, it just loops.  If I could get this to work, I should then be able to create a scheduled task.
  User generated image
ASKER CERTIFIED SOLUTION
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 Reece

ASKER

OK, I did not know that...  So simple!    Why is that though???

Thanks dude.  Scheduled task works fine now.
Glad I could help :)
Avatar of Reece

ASKER

thanks again guys