Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > VB Script

Vista - Copy file to Document and Settings folder permission problem

Reply
 
Old 09-25-2008   #1 (permalink)
Philip Tattersall


 
 

Copy file to Document and Settings folder permission problem


I am trying to copy a file from a location on a server into the
following directory on local pc's
C:\Documents and Settings\All Users\Application Data

I can copy the file with no trouble to c:\Documents and Settings.
However I get a permission denied error code 800a0046 message and the
script fails when trying o copy to
C:\Documents and Settings\All Users\Application Data.

The code I'm using is below. Any suggestions would be much appreciated.

Dim FSO

Set FSO = CreateObject("Scripting.FileSystemObject")

FSO.CopyFile "z:\scripts\test.txt", "C:\Documents and Settings\All
Users\Application Data"

*** Sent via Developersdex http://www.developersdex.com ***

My System SpecsSystem Spec
Old 09-25-2008   #2 (permalink)
esska


 
 

Re: Copy file to Document and Settings folder permission problem

Try to copy the script:
Copying a File

Demonstration script that uses the FileSystemObject to copy a file.
Script must be run on the local computer.

Const OverwriteExisting = True
Set objFSO = CreateObject("Scripting.FileSystemObject")
objFSO.CopyFile "C:\FSO\ScriptLog.txt" , "D:\Archive\",
OverwriteExisting

source:
http://www.activexperts.com
My System SpecsSystem Spec
Old 09-25-2008   #3 (permalink)
James Whitlow


 
 

Re: Copy file to Document and Settings folder permission problem

"Philip Tattersall" <philip@xxxxxx> wrote in message
news:esPQYIwHJHA.3736@xxxxxx
Quote:

>
> I am trying to copy a file from a location on a server into the
> following directory on local pc's
> C:\Documents and Settings\All Users\Application Data
>
> I can copy the file with no trouble to c:\Documents and Settings.
> However I get a permission denied error code 800a0046 message and the
> script fails when trying o copy to
> C:\Documents and Settings\All Users\Application Data.
>
> The code I'm using is below. Any suggestions would be much appreciated.
>
> Dim FSO
>
> Set FSO = CreateObject("Scripting.FileSystemObject")
>
> FSO.CopyFile "z:\scripts\test.txt", "C:\Documents and Settings\All
> Users\Application Data"
You need to add a backslash to the end of your destination so that it
knows it is a directory. As written, it is trying to copy 'test.txt' to
'C:\Documents and Settings\All Users' with a filename of 'Application Data'.
The error is a result of there already being a folder with that name in the
directory.


My System SpecsSystem Spec
Old 09-25-2008   #4 (permalink)
Al Dunbar


 
 

Re: Copy file to Document and Settings folder permission problem


"James Whitlow" <jwhitlow.60372693@xxxxxx> wrote in message
news:OU5Er60HJHA.788@xxxxxx
Quote:

> "Philip Tattersall" <philip@xxxxxx> wrote in message
> news:esPQYIwHJHA.3736@xxxxxx
Quote:

>>
>> I am trying to copy a file from a location on a server into the
>> following directory on local pc's
>> C:\Documents and Settings\All Users\Application Data
>>
>> I can copy the file with no trouble to c:\Documents and Settings.
>> However I get a permission denied error code 800a0046 message and the
>> script fails when trying o copy to
>> C:\Documents and Settings\All Users\Application Data.
>>
>> The code I'm using is below. Any suggestions would be much appreciated.
>>
>> Dim FSO
>>
>> Set FSO = CreateObject("Scripting.FileSystemObject")
>>
>> FSO.CopyFile "z:\scripts\test.txt", "C:\Documents and Settings\All
>> Users\Application Data"
>
> You need to add a backslash to the end of your destination so that it
> knows it is a directory. As written, it is trying to copy 'test.txt' to
> 'C:\Documents and Settings\All Users' with a filename of 'Application
> Data'. The error is a result of there already being a folder with that
> name in the directory.
Or, since the copy seems to be from a remote share mapped as Z:, perhaps
this is running as a logon script in the security context of an account that
does not have local admin privileges. If so, it might be better to run a
script that pushes the file out to remote systems' in that particular
folder.

/Al


My System SpecsSystem Spec
Old 09-26-2008   #5 (permalink)
esska


 
 

Re: Copy file to Document and Settings folder permission problem

The problem is with script not with permissions However if you want
to copy to share folder you need to have domain user rights.

Regards,

My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
document and settings access problem Vista file management
Lost document or file folder Vista file management
You need permission to perform this action!! to copy a file to a directory with Admin rights Vista security
View and copy document content without opening the document Vista General
View and copy document content without opening the document Vista performance & maintenance


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46