Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 314
  • Last Modified:

Task Schedule Anomaly

I have a bat file that I want the Task scheduler run.  The bat file is set to run a DFSR health report and then send an email with an attachment of the file.  The bat file works fine when I run it.  However, when I run it as a scheduled task I get an error saying

<Error attaching file W:\....\QB Timer Files-11-29-2010-0528PM.html'.>

Can anyone help me determine why I only get this error when this bat file is started by the task manager and help me find a fix?

Thanks
0
ITPro44
Asked:
ITPro44
  • 2
  • 2
  • 2
1 Solution
 
sweetfa2Commented:
Your W drive is not mapped in the scheduled task.

You need to either map the drive in your script or use the UNC form of pathname

\\server\\share\pathtofile

0
 
Deepu AbrahamR & D Engineering ManagerCommented:
Did you mean task scheduler? Do you have any user logged in at that time? Task scheduler will run as system/machine context. While you run it will take your user token an run.
Have a look at these

http://support.microsoft.com/kb/951246
http://technet.microsoft.com/en-us/library/cc721846.aspx

Have a look at this thread:
http://social.technet.microsoft.com/Forums/en-US/winservermanager/thread/d47d116e-10b9-44f0-9a30-7406c86c2fbe/
0
 
Deepu AbrahamR & D Engineering ManagerCommented:
If it is a drive mapping issue how does it work while running it manually.



0
Making Bulk Changes to Active Directory

Watch this video to see how easy it is to make mass changes to Active Directory from an external text file without using complicated scripts.

 
sweetfa2Commented:
Because you are already logged in.  The task scheduler is not necessarily logged in.
0
 
ITPro44Author Commented:
sweetfa2, you are right.  I put a  net use command into the file to map the drive and that solved that problem.  Additionally to get things fully working I also had to call out the full path for the email command line rather then just the name of the exe file.  I also had to set the task to run with the highest privileges.

Thanks guys!

P.S.  here is a good cmd line email application to use that can send attachments. http://www.codeproject.com/KB/IP/cpcommandlineemailer.aspx   
0
 
ITPro44Author Commented:
thanks again
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

What Kind of Coding Program is Right for You?

There are many ways to learn to code these days. From coding bootcamps like Flatiron School to online courses to totally free beginner resources. The best way to learn to code depends on many factors, but the most important one is you. See what course is best for you.

  • 2
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now