Hi,
I have read through other forums regarding this error. I am receiving
it with the destination parameter.
I am trying to use a variable I have contructed with the UNC and a
users name.
I have tried with qoutes & w\o, tried with file name & w\o, with the
last backlash & w\o.
If I enter the destination are a UNC path in quotes works like a charm,
but not when I construct the destination.

Here is my code, take a look and let me know what the problem is:


'Creates folder on \\server\share\ with user's SAMaccount Name
'dim filesys, newfolder, newfolderpath
newfolderpath = "\\server\share\" & samaccount
wscript.echo newfolderpath
set filesys=CreateObject("Scripting.FileSystemObject")

Set newfolder = filesys.CreateFolder(newfolderpath)

'Copies \\server\share\%newuser%\HPAPP.DAT to folder just created

newfolderpath1 = CHr(34) & newfolderpath & "\"
wscript.echo "newfolderpath1: " & newfolderpath1
fullpath = newfolderpath1 & Chr(34) '& "HPAPP.DAT"
Wscript.echo "fullpath: " & fullpath '
' fullpath1 = fullpath & Chr(34)
' Wscript.echo "fullpath1: " & fullpath

fso.CopyFile "\\server\share\newuser%\HPAPP.DAT", fullpath


Thanks in advance - GB

RE: CopyFile returns error 800A0034 by jefrie

jefrie
Wed Feb 22 06:49:28 CST 2006

Hi,

so you want to copy the HPAPP.DAT from shareA to shareB ?

Maybe you should map a network drive and just copy the file with a "normal"
copyjob ?

Mapping drives:
Set objNet = CreateObject("Wscript.Network")
' >>> objNet.MapNetworkDrive(strLocalName, strRemoteName, [bUpdateProfile],
[strUser], [strPassword])

But first you should check if the network drive is already mapped/in use with
Set objNet = CreateObject("Wscript.Network")
Set collectionDrives = objNet.EnumNetworkDrives
For i=0 To collectionDrives.Count-1 Step 2
WScript.Echo collectionDrives(i)
Next

When you have a mapped drive use something like this:

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

Hope this will help you.
Tip: double " (like "") will be treatend as one
> WScript.Echo """hello my ""friend"""""
--
Jens Frieben (Germany)


"gb" wrote:

> Hi,
> I have read through other forums regarding this error. I am receiving
> it with the destination parameter.
> I am trying to use a variable I have contructed with the UNC and a
> users name.
> I have tried with qoutes & w\o, tried with file name & w\o, with the
> last backlash & w\o.
> If I enter the destination are a UNC path in quotes works like a charm,
> but not when I construct the destination.
>
> Here is my code, take a look and let me know what the problem is:
>
>
> 'Creates folder on \\server\share\ with user's SAMaccount Name
> 'dim filesys, newfolder, newfolderpath
> newfolderpath = "\\server\share\" & samaccount
> wscript.echo newfolderpath
> set filesys=CreateObject("Scripting.FileSystemObject")
>
> Set newfolder = filesys.CreateFolder(newfolderpath)
>
> 'Copies \\server\share\%newuser%\HPAPP.DAT to folder just created
>
> newfolderpath1 = CHr(34) & newfolderpath & "\"
> wscript.echo "newfolderpath1: " & newfolderpath1
> fullpath = newfolderpath1 & Chr(34) '& "HPAPP.DAT"
> Wscript.echo "fullpath: " & fullpath '
> ' fullpath1 = fullpath & Chr(34)
> ' Wscript.echo "fullpath1: " & fullpath
>
> fso.CopyFile "\\server\share\newuser%\HPAPP.DAT", fullpath
>
>
> Thanks in advance - GB
>
>

Re: CopyFile returns error 800A0034 by gb

gb
Wed Feb 22 07:52:20 CST 2006

Still getting the error with the strTarget, if I construct the var.
with the samaccount :

See below:

Set objNet = CreateObject("Wscript.Network")
objNet.RemoveNetworkDrive"E:"

objNet.MapNetworkDrive "E:", "\\w0hqhpe1\hpapp"

'objNet.MapNetworkDrive(strLocalName, strRemoteName,
[bUpdateProfile],[strUser], [strPassword])


Target = "E:\" & samaccount & "\HPAPP.DAT"
wscript.Echo target


strSource = "E:\%newuser%\HPAPP.DAT"
strTarget = chr(34) & target & Chr(34)
Wscript.echo strTarget
Const OverwriteExisting = TRUE
Set objFSO = CreateObject("Scripting.FileSystemObject")
objFSO.CopyFile strSource, strTarget, OverwriteExisting

I have to be able to reference the folder I create earlier in the
script that is named by the var. samaccount

Thank you in advance.

GB


Re: CopyFile returns error 800A0034 by gb

gb
Wed Feb 22 08:34:36 CST 2006

Figured it out, the destination should not contain the file name.

GB