Discussion Locked

Scheduled Tasks

0 helpful
13 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Hi,
I'm experiencing a very strange behavior lately when trying to run a scheduled 'bat' file. I have made some troubleshooting and find out that part of the commands the batch file runs as expected and the part that is failing is the command "net use" which should be created as part of the task. I also tried to create a new batch file which has only the command "net use" pointing to the same network share and also to different network share but the task will not even run. The user that the task is scheduled to run under is both a local and a domain admin. When I double click on the ?bat? file all the commands are executed as expected. Any idea how to solve this problem?

13 replies

by allthegoodnamesweregone

is it intended to map drives for the logged in user? if so, it's only going to map drives for the account that is being used to run the task.

what is the script supposed to do? maybe we can help you out from another angle.

by m.graft

Thanks for your replay. what the scrip do is copying log files from a remote machine, compress the log files, send them to a folder on the source machine, and then copy the zipped file to another remote machine where user are able to download them. The task has been scheduled to run every 15min. The same task did run before and just out of the blue stopped running the part where the drive map needs to be created. A user and password are included in the script for a user with permission on the remote machine. As I already mentioned when I double click on the 'bat' file everything work fine again?

by m.graft

Thanks for your replay. what the scrip do is copying log files from a remote machine, compress the log files, send them to a folder on the source machine, and then copy the zipped file to another remote machine where user are able to download them. The task has been scheduled to run every 15min. The same task did run before and just out of the blue stopped running the part where the drive map needs to be created. A user and password are included in the script for a user with permission on the remote machine. As I already mentioned when I double click on the 'bat' file everything work fine again?

by sgt_shultz

if the bat file will run but the scheduled task to run it fails, the most common reason in my exprerience is a password change. If you look carefully at the properties of the scheduled task you may which username (and password) it uses.

by sprdave32

This is almost always a username/password/permissions problem. Set the task to run under your domain admin account and be sure the PW is current. I am taking for granted that you are in a domain environment in which the permissions are network wide for an account (if the permissions are different at the remote machine for the account you specify then "net use" may fail). When you double click the .bat file to run it you are using the permissions of the account you are logged in as, most likely a domain admin account. Good Luck!
Dave

by ctdak

I had this exact problem once. In my case I was doing an XCOPY in a scheduled bat file and was trying to copy files from a mapped network drive (a secondary server) to a local drive using the drive map letter. The solution was simply to replace the drive map letter with \\ServerName\...

by m.graft

Here how the script looks like:
Net use * \\10.10.10.3\c$ /user:USER PASSWORD
Xcopy /c /r /z /d /y \\10.10.10.1\log\*.log \\10.10.10.2\f$\tslog\temp\Pro\
Xcopy /c /r /z /d /y \\10.10.10.1\dump\*.log \\10.10.10.2\f$\tslog\temp\Pro\
pacomp -m -c[2] \\10.10.10.2\f$\tslog\backup\Pro\PLog.zip \\10.10.10.2\f$\tslog\temp\Pro\*.*
Namedate /U /XZ"dmY" \\10.10.10.2\f$\tslog\backup\Pro\PLog.zip
Xcopy /R /Y \\10.10.10.2\f$\tslog\backup\pro\*.zip "\\10.10.10.2\c$\Inetpub\wwwroot\TelematicsTools\Logs\Production\"
MD "\\10.10.10.2\f$\tslog\backup\Pro\PLOG2005\"
Move /Y \\10.10.10.2\f$\tslog\backup\Pro\*.zip \\10.10.10.3\f$\tslog\backup\Pro\PLOG2005\
Net use * /delete /yes

*Noticed that I have replaced the original IP-address with fictive one instead.
*10.10.10.1 = Remote server where log files are copied from.
*10.10.10.2 = Server where the log files are copied & where the Scheduled Tasks is running from.
*10.10.10.3 = Remote DMZ server (not a member of the DC) where the *.zip file is copied too from 10.10.10.2.

I tried to run a task with only the command 'net use * \\10.10.10.2\c$' (which is the same machine where the task is running from) but when I keep monitoring the scheduled tasks nothing happen under status where usually you can see when the task is started it shows 'running'. This is really puzzling me and I hope I can understand what is wrong and why the command 'net use' is not executed from the scheduled tasks. I also tried and used the AT command to run the batch file, but the same happened again.

by maesend

Before the "net use x: \\pc\share"
insert "net use x: /d"
Because the batch can't create the share when it is already existing

Dany

by m.graft

Hi,
I use the command 'net use * /delete /yes' which deletes any existing share. I didn't understand your solution about inserting the command 'net use x: /d' before 'net use x: \\pc\share', does this mean using it twice, e.g. (net use x: /d net use x: \\pc\share\.? But again, the batch file works perfectly when double clicking on it, it is only when it has to be running from the scheduled tasks applet that some commands are not being executed.

by salehfattah

you should login to windows with user name and password
if you automatic log in it does not work !!!!

by geoffroy.mondy

Hi,
We also experiment the same problem.
In fact, it's seems to happend sinds security patch install on Windows 2000 & 2003 servers.
On Windows NT4.0 targeted servers (from the batch), we do not have any problems...
Regards,
Joe.

by m.graft

Thank you. That was the answer I was looking for since I know that it did work before the upgrade and now it doesn't. Do you know by any chance which security patch it was? You can send me the answer on my email when it is possible.

This discussion is closed to new replies.