• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 3270
  • Last Modified:

Scheduled Task accessing network drive

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
tedhyu
Asked:
tedhyu
1 Solution
 
David LeeCommented:
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
 
tedhyuAuthor Commented:
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
 
mhambridgeCommented:
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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
oBdACommented:
Use the UNC path instead of a mapped drive letter.
copy \\SomeServer\SomeShare\file.txt c:\file.txt
0
 
David LeeCommented:
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
 
tedhyuAuthor Commented:
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
 
tedhyuAuthor Commented:
SORRY, it's been a long week.  I just tested again, and turning off permissions does not work.  Same error as b4.
0
 
tedhyuAuthor Commented:
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
 
jholland79Commented:
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
 
David LeeCommented:
How are you mapping the drive?  Is it mapped before hand, or is it mapped by this program you are running?  
0
 
tedhyuAuthor Commented:
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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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