Solved

Running bat file as scheduled task doesn't work in Vista

Posted on 2009-05-14
3
430 Views
Last Modified: 2012-05-07
I am going crazy trying to sort out this issue.  I have a bat file that maps two network drives and then executes a vbs file (contents in code section).  It runs correctly from the command line but as a scheduled task it doesn't do anything.  Is say it completed successfully with code 0x0 but it didn't do what it was supposed to do.

I have "Run with highest privileges" checked.  I'm logged in as an administrator and I have the task scheduled to run with an administrator account.
net use H: \\wvdl1\wvdl-m\

net use Y: \\wvdl8\D$

cscript /nologo G:\BSEtoNAHLNonHK.vbs

Open in new window

5-14-2009-3-18-15-PM.jpg
0
Comment
Question by:hlking
  • 2
3 Comments
 
LVL 8

Expert Comment

by:sjl1986
ID: 24389414
It shouldn't make any difference, but I don't have Vista so I can't test it, but did you try renaming the .BAT to a .CMD file and running it that way? Like I said, it may not fix your problem but it's worth a shot.

Are you sure it is actually running? Do you see it pop up when it's scheduled time arrives? Another good way to trouble shoot it to put 'pause' after each line in the code and then sit there when it runs to see if anything in the code is causing it to fail. If the batch simply starts Vista will tell you that the file ran. The task scheduler has no idea what the file contains and if the file errors out and fails it will close prematurely even though the task scheduler thinks it completed because it stopped.
0
 

Accepted Solution

by:
hlking earned 0 total points
ID: 24389673
Argghh...the problem was the back slash at the end of my first NET USE command.  The reason it didn't fail when run from a command line is because I already had that drive letter mapped.  

Thanks for your ideas sjl1986.
0
 
LVL 8

Expert Comment

by:sjl1986
ID: 24389829
Ok. No problem. Glad you got it working.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hi All Just a quick one for everybody. I was recently looking into setting the default User Account Picture for all my vista clients within the network but on closer inspection the group policy setting only allows you to set the default pictur…
The main issue when installing Vista and XP in dual boot is when you have to reinstall any of the two when something fails, let's say a hard disk failure, a lost partition, virus, etc. What commonly happens is that you lose all your hard work config…
The Task Scheduler is a powerful tool that is built into Windows. It allows you to schedule tasks (actions) on a recurring basis, such as hourly, daily, weekly, monthly, at log on, at startup, on idle, etc. This video Micro Tutorial is a brief intro…
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now