Copying files from a server to another

K

KK

Hello,

I am running into a problem for copying files between 2 different servers.
I am using the following lines of code to do that, but I get a 'permission
denied' error

Set fso = Server.CreateObject("Scripting.FileSystemObject")
strSourceFile = "\\server1\file1.doc"
strDestFile = "\\server2\file1.doc"
fso.CopyFile strSourceFile,strDestFile, true

Please advise

Thanks in advance
KK
 
P

Patrice

Looks like the share name is missing. You have just a server name and a file
?

Patrice
 
K

KK

Sorry, I missed the share.
strSourceFile = "\\server1\c$\file1.doc"
strDestFile = "\\server2\c$\file1.doc"
But that does not solve the problem...
 
T

Tom Kaminski [MVP]

KK said:
Sorry, I missed the share.
strSourceFile = "\\server1\c$\file1.doc"
strDestFile = "\\server2\c$\file1.doc"
But that does not solve the problem...

"C$" is a hidden share only accessible to administrators. I would suggest
creating a different share specifically for your web app.
 
B

Bob Barrows [MVP]

Curt_C said:
all $ shares are special, try a NON admin (non $) share

Not quite. "$" just means the share is hidden. As long as users have
permissions to use them, they should be able to: admin or not.

It is true that the c$, d$, etc shares created by default are limited to
admin users. But shares with names ending with "$" can be created on
subfolders, and permissions for them can be granted to non-admin users. The
shares will be hidden from view to users who have not been granted
permissions to use those shares.

Bob Barrows
 
C

Curt_C [MVP]

Bob said:
Not quite. "$" just means the share is hidden. As long as users have
permissions to use them, they should be able to: admin or not.

It is true that the c$, d$, etc shares created by default are limited to
admin users. But shares with names ending with "$" can be created on
subfolders, and permissions for them can be granted to non-admin users. The
shares will be hidden from view to users who have not been granted
permissions to use those shares.

Bob Barrows
You misinterpreted...
Just meant $ were special (hidden) not that they are ADMIN. the c$/f$
are Admin I'm betting. Meant to say "try a non $ AND a non-admin" share :}
 
K

KK

As far as I know the problem seems to be of granting permissions for the
account used by IIS on server2. I tried giving IUSR_Server1 full access, but
that did not help
 
C

Curt_C [MVP]

Full access to the SHARE or to the Folder/File? These are different things.
Try using a regular user (preferably and Admin account) as a test once.
This will tell you if its a permissions thing.
 
R

Roland Hall

in message
: As far as I know the problem seems to be of granting permissions for the
: account used by IIS on server2. I tried giving IUSR_Server1 full access,
but
: that did not help

Permissions are more difficult when it's on an Intranet and the anonymous
user is enabled. Since you're using the anonymous user, you then need to
make sure anyone that has rights (LAN) does not connect to IIS on a link
that uses their credentials. They must first connect as an anonymous user.
Your log should show how they're connecting, which will show why they're
being denied.

Surely you're not giving the anonymous user rights to d$, which would then
require propagating that down the tree to the necessary path required.

--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library - http://msdn.microsoft.com/library/default.asp
 
P

Patrice

Plan B then ;-)

Likely really a permission problem :
- check the account under which runs your page (usually IUSR_<machine> if
anonymous, or under the user account if authenticated)
- check that this account is allowed to access this share as well as the
underlying files (unlikely as they are admin shares).

I would create my own shares and would grant access to the needed account
(or group).

Patrice

--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,535
Members
45,007
Latest member
obedient dusk

Latest Threads

Top