?
Solved

Scheduled Task accessing network drive

Posted on 2005-03-04
11
Medium Priority
?
2,897 Views
Last Modified: 2010-09-09
This is a general question about accessing network drive files using scheduled task.  Let's say I have a file on my network drive called "Z:\"  I want to copy this file to my local computer using dos commands that are either on a local batch file, VBS file or a compiled .exe program.  

The code would be something like the following:

system("copy "Z:\file.txt" "C:\file.txt"");

This code is saved in the above mentioned batch, VBS, or .exe program.  

1)  When I run this program manually, this copy would work.
2)  When I run this program off a windows scheduled task where both the source and destination folders are on my local computer, it would copy accordingly.

However, the combination of the two above:

3)  When I run this program off a windows scheduled task where the source folder is a network drive, the file cannot be read.  

I have windows XP installed.  Just wondering what is going on with this case.  Is there some sort of windows security that prevents me from accessing the file with scheduled task when it is in a network drive?    Thanks for any comments.
0
Comment
Question by:tedhyu
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
11 Comments
 
LVL 76

Expert Comment

by:David Lee
ID: 13463792
Hi tedhyu,

What you describe sounds like a permissions problem.  My guess is that the account the scheduled task is running under doesn't have the necessary permissions to access the network drive.  So my first question would be, is the scheduled task running under your account?  

Cheers!
0
 

Author Comment

by:tedhyu
ID: 13463798
Yes it is.  How would I turn the permission off?  

BTW, the error message does not say you do not have permission.  It says "file not found".
0
 
LVL 8

Expert Comment

by:mhambridge
ID: 13463810
Hi,

What account name are you using to run the scheduled task that is located on the network drive? Does the account name being used have the appropriate permissions to access where the scheduled task is?
0
Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

 
LVL 85

Accepted Solution

by:
oBdA earned 2000 total points
ID: 13463843
Use the UNC path instead of a mapped drive letter.
copy \\SomeServer\SomeShare\file.txt c:\file.txt
0
 
LVL 76

Expert Comment

by:David Lee
ID: 13463869
tedhyu,
> How would I turn the permission off?

You can't turn off NTFS permissions.  "File not found" doesn't have to be a permissions problem, it could be other things.  Are you trying to access the file via a mapped drive, or via a server path (e.g. \\Server\Share\File)?  
0
 

Author Comment

by:tedhyu
ID: 13463907
Hi tedhyu,

What you describe sounds like a permissions problem.  My guess is that the account the scheduled task is running under doesn't have the necessary permissions to access the network drive.  So my first question would be, is the scheduled task running under your account?  

Cheers!

>>I followed the following instructions to turn off password protection for scheduled tasks and it now works on my computer.  However, it is quite tedious, and it would be nice if I can have a script that disables the password protection automatically.  The reason being, I need this to run on the customers' computers, not just my own.

How to run scheduled tasks without a password

Some readers have written with problems using the Scheduled Task feature. They schedule tasks to run automatically, but they get messages that say "the scheduled task did not run because an incorrect password or user name was used." This happens when the user account under which the tasks are scheduled to run has a blank password.

One workaround is to assign a password to the account, which is a good idea for security reasons. However, if you don't want to do that, it is possible to run scheduled tasks without a password.

If you're using XP Pro, you'll need to edit the Local Security Policy. Here's how:

Click Start | Control Panel | Administrative Tools | Local Security Policy.
In the Local Security Policy console, expand Local Policies and click Security Options.
In the right pane, double click the entry that says Accounts: Limit local account use of blank passwords to console logon only.
By default, this policy is enabled. Click Disabled to disable it.
Click OK, and close the Local Security Policy console.
0
 

Author Comment

by:tedhyu
ID: 13463930
SORRY, it's been a long week.  I just tested again, and turning off permissions does not work.  Same error as b4.
0
 

Author Comment

by:tedhyu
ID: 13464176
I'm trying to access the file via a mapped drive.  The program that I run to access the mapped drive works if it is operated manually (double click or through DOS), but it does not work when it runs off of scheduled task.  This is not an isolated incident, and I have seen this problem on 3 computers including my own.

I'm not sure if there is a solution for this.  It could be just a windows bug.  In any case, hope someone can lead me in the right direction.  If not, have a nice weekend.
0
 
LVL 6

Expert Comment

by:jholland79
ID: 13465569
Hi there,
have you tried the suggestion above, to use a UNC (\\Server\Share\Folder\File) path to the executable?
Are you logged on to the machine when the scheduled task runs?
If not, I'm guessing that maybe windows won't have assigned Z: to the folder in question, since you won't have actually logged on.
Also, have you checked the event logs for errors. That might give us some indication as to the cause of this problem.
Regards,
John.
0
 
LVL 76

Expert Comment

by:David Lee
ID: 13466021
How are you mapping the drive?  Is it mapped before hand, or is it mapped by this program you are running?  
0
 

Author Comment

by:tedhyu
ID: 13478532
Thanks for all your comments.  I tried the UNC path instead of the mapped path and it works.  Kind of strange, but it's a good solution.  I'm using a setup program called InnoSetup to map the path.  It runs on a version of Delphi/Pascal.  I'm gonna post another question under Delphi to figure out if it is possible to read the UNC path using this program.  If you have any ideas, I'm gonna post the questions as (mapping UNC path).

Ted
0

Featured Post

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

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

Migration of Exchange mailbox can be done with the ExProfre.exe tool. But at times, when the ExProfre.exe tool migrates the Exchange Server user profile, it results in numerous synchronization problems. Synchronization error messages appear in the e…
Can you find a fax from a vendor you saved a decade ago in seconds? Have you ever cursed your PC under your breath during an audit because you couldn’t find the requested statement or driver history?  If you answered no to the first question or yes …
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

741 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