Copying files from a server to another

Discussion in 'ASP General' started by KK, Jun 14, 2005.

  1. KK

    KK Guest

    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
    KK, Jun 14, 2005
    #1
    1. Advertising

  2. KK

    Patrice Guest

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

    Patrice

    --

    "KK" <> a écrit dans le message de
    news:...
    > 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
    >
    Patrice, Jun 14, 2005
    #2
    1. Advertising

  3. KK

    KK Guest

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


    "Patrice" wrote:

    > Looks like the share name is missing. You have just a server name and a file
    > ?
    >
    > Patrice
    >
    > --
    >
    > "KK" <> a écrit dans le message de
    > news:...
    > > 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
    > >

    >
    >
    >
    KK, Jun 14, 2005
    #3
  4. "KK" <> wrote in message
    news:...
    > 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.

    --
    Tom Kaminski IIS MVP
    http://www.microsoft.com/windowsserver2003/community/centers/iis/
    http://mvp.support.microsoft.com/
    http://www.iistoolshed.com/ - tools, scripts, and utilities for running IIS
    Tom Kaminski [MVP], Jun 14, 2005
    #4
  5. KK

    KK Guest

    I changed it to d$, but that did not help either.

    "Tom Kaminski [MVP]" wrote:

    > "KK" <> wrote in message
    > news:...
    > > 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.
    >
    > --
    > Tom Kaminski IIS MVP
    > http://www.microsoft.com/windowsserver2003/community/centers/iis/
    > http://mvp.support.microsoft.com/
    > http://www.iistoolshed.com/ - tools, scripts, and utilities for running IIS
    >
    >
    >
    KK, Jun 14, 2005
    #5
  6. KK

    Curt_C [MVP] Guest

    KK wrote:
    > I changed it to d$, but that did not help either.
    >
    > "Tom Kaminski [MVP]" wrote:
    >
    >
    >>"KK" <> wrote in message
    >>news:...
    >>
    >>>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.
    >>
    >>--
    >>Tom Kaminski IIS MVP
    >>http://www.microsoft.com/windowsserver2003/community/centers/iis/
    >>http://mvp.support.microsoft.com/
    >>http://www.iistoolshed.com/ - tools, scripts, and utilities for running IIS
    >>
    >>
    >>

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

    --
    Curt Christianson
    site: http://www.darkfalz.com
    blog: http://blog.darkfalz.com
    Curt_C [MVP], Jun 14, 2005
    #6
  7. Curt_C [MVP] wrote:
    >>>

    > 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

    --
    Microsoft MVP -- ASP/ASP.NET
    Please reply to the newsgroup. The email account listed in my From
    header is my spam trap, so I don't check it very often. You will get a
    quicker response by posting to the newsgroup.
    Bob Barrows [MVP], Jun 14, 2005
    #7
  8. KK

    Curt_C [MVP] Guest

    Bob Barrows [MVP] wrote:
    > Curt_C [MVP] wrote:
    >
    >>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
    >

    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 :}

    --
    Curt Christianson
    site: http://www.darkfalz.com
    blog: http://blog.darkfalz.com
    Curt_C [MVP], Jun 14, 2005
    #8
  9. KK

    KK Guest

    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

    "Curt_C [MVP]" wrote:

    > Bob Barrows [MVP] wrote:
    > > Curt_C [MVP] wrote:
    > >
    > >>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
    > >

    > 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 :}
    >
    > --
    > Curt Christianson
    > site: http://www.darkfalz.com
    > blog: http://blog.darkfalz.com
    >
    KK, Jun 14, 2005
    #9
  10. KK

    Curt_C [MVP] Guest

    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.


    --
    Curt Christianson
    site: http://www.darkfalz.com
    blog: http://blog.darkfalz.com


    KK wrote:
    > 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
    >
    > "Curt_C [MVP]" wrote:
    >
    >
    >>Bob Barrows [MVP] wrote:
    >>
    >>>Curt_C [MVP] wrote:
    >>>
    >>>
    >>>>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
    >>>

    >>
    >>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 :}
    >>
    >>--
    >>Curt Christianson
    >>site: http://www.darkfalz.com
    >>blog: http://blog.darkfalz.com
    >>
    Curt_C [MVP], Jun 14, 2005
    #10
  11. KK

    Roland Hall Guest

    "KK" wrote in message
    news:...
    : 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
    Roland Hall, Jun 14, 2005
    #11
  12. KK

    Patrice Guest

    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

    --

    "KK" <> a écrit dans le message de
    news:...
    > Sorry, I missed the share.
    > strSourceFile = "\\server1\c$\file1.doc"
    > strDestFile = "\\server2\c$\file1.doc"
    > But that does not solve the problem...
    >
    >
    > "Patrice" wrote:
    >
    > > Looks like the share name is missing. You have just a server name and a

    file
    > > ?
    > >
    > > Patrice
    > >
    > > --
    > >
    > > "KK" <> a écrit dans le message de
    > > news:...
    > > > 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
    > > >

    > >
    > >
    > >
    Patrice, Jun 15, 2005
    #12
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    0
    Views:
    478
  2. TB
    Replies:
    0
    Views:
    911
  3. TB
    Replies:
    5
    Views:
    440
    Phillip Williams
    Oct 29, 2005
  4. Sarah

    Copying Files From Server to Server

    Sarah, Nov 13, 2004, in forum: ASP General
    Replies:
    1
    Views:
    94
    Ray Costanzo [MVP]
    Nov 15, 2004
  5. Shawn Mcclain
    Replies:
    0
    Views:
    177
    Shawn Mcclain
    Sep 28, 2007
Loading...

Share This Page