Solved

Task Schedule Anomaly

Posted on 2010-11-29
6
275 Views
Last Modified: 2012-09-27
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
Comment
Question by:ITPro44
  • 2
  • 2
  • 2
6 Comments
 
LVL 17

Accepted Solution

by:
sweetfa2 earned 500 total points
ID: 34235768
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
 
LVL 11

Expert Comment

by:DeepuAbrahamK
ID: 34235780
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
 
LVL 11

Expert Comment

by:DeepuAbrahamK
ID: 34235802
If it is a drive mapping issue how does it work while running it manually.



0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
LVL 17

Expert Comment

by:sweetfa2
ID: 34235862
Because you are already logged in.  The task scheduler is not necessarily logged in.
0
 

Author Comment

by:ITPro44
ID: 34241434
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
 

Author Closing Comment

by:ITPro44
ID: 34241442
thanks again
0

Featured Post

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

New Windows 7 Installations take days for Windows-Updates to show up and install. This can easily be fixed. I have finally decided to write an article because this seems to get asked several times a day lately. This Article and the Links apply to…
If you’re thinking to yourself “That description sounds a lot like two people doing the work that one could accomplish,” you’re not alone.
This tutorial will walk an individual through the process of transferring the five major, necessary Active Directory Roles, commonly referred to as the FSMO roles to another domain controller. Log onto the new domain controller with a user account t…
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

863 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

18 Experts available now in Live!

Get 1:1 Help Now