Re: Script to Copy Files from a Share to a Client Not Working

From: Al Mulnick (amulnick_No_SPAM_at_ncDOTrr.com)
Date: 10/14/04


Date: Wed, 13 Oct 2004 21:16:07 -0400

If I might make a suggestion, I think you'll get better results in a
scripting NG for that question. I will say that you likely should
troubleshoot this a little more, such as not using %systemroot% as your
destination. You may want to hard-code the paths and back out from there
until you're using variables and UNC paths.
Not sure how vbscript would handle the %systemroot% variable, but I haven't
had a lot of luck with it.

Here's the syntax if you haven't found it yet
(http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/jsmthcopyfile.asp).

Arguments
  object
  Required. The object is always the name of a FileSystemObject.
  source
  Required. Character string file specification, which can include wildcard
characters, for one or more files to be copied.
  destination
  Required. Character string destination where the file or files from source
are to be copied. Wildcard characters are not allowed.
  overwrite
  Optional. Boolean value that indicates if existing files are to be
overwritten. If true, files are overwritten; if false, they are not. The
default is true. Note that CopyFile will fail if destination has the
read-only attribute set, regardless of the value of overwrite.

"ptwilliams" <ptw2001@hotmail.com> wrote in message
news:OJ0UEtUsEHA.3200@TK2MSFTNGP09.phx.gbl...
> I'm very new to scripting, so I may be mistaken, but I believe that you
> are
> instantiating a 'local' object there; which will probably not allow you to
> copy from the network -if you've read this elsewhere, then go with that
> (I'm
> just surmising based on what you've told me).
>
> However, a mapped drive ought to sort it :)
>
> --
>
> Paul Williams
>
> http://www.msresource.net
> http://forums.msresource.net
> ______________________________________
> "Louis Lokuta" <anonymous@discussions.microsoft.com> wrote in message
> news:052a01c4b135$d9d3b590$a401280a@phx.gbl...
> Paul,
>
> Thanks again. I have the permissions applied now, so that
> worked great. The script is in place and is executing as
> well, but I'm still having a script error when the actual
> copy attempts to take place.
>
> I get two different messages: either permission denied
> or path not found. Permission denied is bogus, because I
> have the rights and if I copy the file from a disk or
> flash drive to the local drive, it works fine.
> Path not found is bogus too, because the path is there.
>
> The copy is instructing the file located on a SERVER to
> be copied to a client, but now I've noticed the WSH
> script I found in the MSDN collection seems to only
> indicate that it works for local file coping (not from
> server).
> Is this true?? How can I copy it from the network to the
> client?
>
> Here is my code:
>
> Dim FSO
> Set FSO = CreateObject("Scripting.FileSystemObject")
> FSO.CopyFile "\\CALLISTO\VOL1\Public\make32vs.bat", "%
> systemdrive%\Program Files\Masm"
>
> Is there a problem in the share name? Server name? Syntax?
> Should I be using UNC conventions to access the source
> file on the server, or the mapped drive letter?
>
>
> Louis
>
>
>>-----Original Message-----
>>No problem Louis!!!
>>
>>Navigate to:
>>
>>\GPO\Computer Configuration\ Windows Settings\ Security
> Settings\ File
>>System
>>
>>Right-click and choose Add file...
>>
>>In here, add the path to the folder that you want to set
> the permissions on
>>and then grant the permissions in the following dialog.
>>
>>
>>
>>* Note. If you can, use system variables, e.g. %
> SYSTEMROOT%, etc.
>>
>>--
>>
>>Paul Williams
>>
>>http://www.msresource.net
>>http://forums.msresource.net
>>______________________________________
>>"Louis Lokuta" <anonymous@discussions.microsoft.com>
> wrote in message
>>news:3dde01c4b011$d7679940$a401280a@phx.gbl...
>>Paul,
>>
>>Thank you so much for the reply. I didn't know about the
>>File System GPO attribute. Unfortunately, I'm not
> familiar
>>with it. Can you give me a quick run down on how to
>>configure this folder permission?
>>
>>
>>
>>>-----Original Message-----
>>>The script will run in user-context (that's using the
>>credentials of the
>>>user logging on) if it's a logon/logoff script.
>>>
>>>The script will run as SYSTEM if it's a startup/shutdown
>>script.
>>>
>>>You'll need a logon script, so will need to either copy
>>the file elsewhere
>>>(probably not suitable for your solution) or set the
>>permissions on the
>>>folder that you wish to write this file to. If you
>>require the latter, use
>>>the File System section of a GPO to set the appropriate
>>permissions on that
>>>folder.
>>>
>>>--
>>>
>>>Paul Williams
>>>
>>>http://www.msresource.net
>>>http://forums.msresource.net
>>>______________________________________
>>><anonymous@discussions.microsoft.com> wrote in message
>>>news:2af701c4ad43$c0fe6c90$a601280a@phx.gbl...
>>>Hello,
>>>
>>>I'm attempting to write a VB login script for
>>>distribution in a GPO to take a file off of a shared
>>>network drive, and copy it to a directory on the client.
>>>
>>>I'm using the following code that I found in the MSDN
>>>collection:
>>>
>>>Dim FSO
>>>Set FSO = CreateObject("Scripting.FileSystemObject")
>>>FSO.CopyFile "K:\Public\make32vs.bat", "c:\Program
>>>Files\Masm"
>>>
>>>When the script runs, I get an error on line #3, the
> part
>>>where the copy starts. It says 'permission denied'. The
>>>script is setup to run when a user (who is a member of
>>>the Users) group logs in. They do not have write
>>>permission to the C:\Program Files folder, so I'm
>>>assuming this is the cause of the problem. However, I
> was
>>>told that when scripts are distributed in a GPO, that
> the
>>>run under the "SYSTEM" account which has full
> permissions
>>>to everything. Is this wrong? How can I make this script
>>>work?
>>>
>>>Also, the file that is being copied already exists on
> the
>>>local machine; I want to overwrite it. Will it get
>>>overwritten when the copy takes place, or do I have to
>>>put in another line in the code to take care of that?
>>>
>>>Please help!!!
>>>Thanks in Advance,
>>>Louis
>>>
>>>
>>>.
>>>
>>
>>
>>.
>>
>
>



Relevant Pages

  • IIS & ASP security advice
    ... I have a user who has requested special permissions on my IIS 5.0 server. ... that they do but IIS does not allow this to happen unless an ASP script is ...
    (microsoft.public.inetserver.iis.security)
  • RE: [PHP] mkdir permission errors
    ... you're running the above script as root. ... Then if you run the same script via the web server, ... and permissions. ... understanding of those if you're going to administer the server. ...
    (php.general)
  • RE: VBS Script Execution Fails with Permission Denied
    ... Sounds though there might be a permissions issue on or around the FSO ... adding these user/groups to the ACLs for the resource etc. Try using Filemon ... question and get them to monitor reg/file access while running the script. ... > Server Specs ...
    (microsoft.public.scripting.vbscript)
  • Re: Permission denied
    ... Server), for example, installs by default without network support, meaning ... attempt to connect to the database. ... then it must be permissions. ... script manually and not as a scheduled task. ...
    (microsoft.public.windows.server.scripting)
  • Re: cant get access to disk share when connecting from a remote s
    ... The systems are DUTs. ... for each of the drives within the system. ... Everything in the scripts work except the file permissions below the shares ... the shares on the DUTs manually, after they run my rename script, but I would ...
    (microsoft.public.windows.server.scripting)