Hello,
I'm want to copy a file to many pc's, either to the desktop or Startup
folder. OS is 2k. Local admin password is the same on all, all pc's in the
same workgroup.
With the script below, I can open the desired folders and manually copy with
no problem.
I can also copy to the root folder. Something else I tried without success
was to copy to C: and create shortcut on remote desktop. I know I can do
this from a local script, but not remotely. Error messages included in
script.
Thanks

Set oFS = CreateObject("Scripting.FileSystemObject")
Set WshShell = WScript.CreateObject("WScript.Shell")
'Open a text file of computer names
Set oTS = oFS.OpenTextFile("F:\getlist\blacat.txt")

Do Until oTS.AtEndOfStream
sComputer = oTS.ReadLine
DesktopPath = WshShell.SpecialFolders("AllUsersDesktop")

WshShell.Run "\\" & sComputer & "\d$\Docume~1\Alluse~1\Desktop"
'This works
WshShell.Run "\\" & sComputer &
"\d$\Docume~1\Alluse~1\StartM~1\Programs\Startup" 'This works
oFS.CopyFile "F:\getlist\metapad.exe" ,"\\" & sComputer & "\c$\"
'This works
Wscript.echo "\\" & sComputer &"\" & DesktopPath
'This works and looks ok
'WshShell.Run "\\" & sComputer &"\" & DesktopPath
'This don't work
'Error Message - The system cannot find the path specified.
'oFS.CopyFile "F:\getlist\metapad.exe" ,"\\" & sComputer &
"\d$\Docume~1\Alluse~1\Desktop" 'This don't work
' Error Message Permission denied.
oFS.CopyFile "C:\scripts\getlist\blacat.txt" ,"\\" & sComputer & "\" &
DesktopPath This don't work
'Error Message path not found
Loop
oTS.Close

Re: Help - cannot copy file to remote desktop by Torgeir

Torgeir
Thu Feb 26 17:49:46 CST 2004

j wrote:

> (snip)
> 'oFS.CopyFile "F:\getlist\metapad.exe" ,"\\" & sComputer &
> "\d$\Docume~1\Alluse~1\Desktop"

Hi

In the line above, you are trying to overwrite the actual folder "Desktop"
with the file "metapad.exe", that will fail fore sure. Try this instead:

oFS.CopyFile "F:\getlist\metapad.exe" , _
"\\" & sComputer & "\d$\Docume~1\Alluse~1\Desktop\"


(note the trailing backslash behind Desktop)

--
torgeir
Microsoft MVP Scripting and WMI, Porsgrunn Norway
Administration scripting examples and an ONLINE version of the 1328 page
Scripting Guide: http://www.microsoft.com/technet/scriptcenter



Re: Help - cannot copy file to remote desktop by j

j
Thu Feb 26 20:08:13 CST 2004

Thanks, that was it exactly.
"Torgeir Bakken (MVP)" <Torgeir.Bakken-spam@hydro.com> wrote in message
news:403E861A.F18FAA38@hydro.com...
> j wrote:
>
> > (snip)
> > 'oFS.CopyFile "F:\getlist\metapad.exe" ,"\\" & sComputer &
> > "\d$\Docume~1\Alluse~1\Desktop"
>
> Hi
>
> In the line above, you are trying to overwrite the actual folder "Desktop"
> with the file "metapad.exe", that will fail fore sure. Try this instead:
>
> oFS.CopyFile "F:\getlist\metapad.exe" , _
> "\\" & sComputer & "\d$\Docume~1\Alluse~1\Desktop\"
>
>
> (note the trailing backslash behind Desktop)
>
> --
> torgeir
> Microsoft MVP Scripting and WMI, Porsgrunn Norway
> Administration scripting examples and an ONLINE version of the 1328 page
> Scripting Guide: http://www.microsoft.com/technet/scriptcenter
>
>



Re: Help - cannot copy file to remote desktop by j

j
Thu Feb 26 20:08:12 CST 2004

Thanks much, that was it exactly.


"Torgeir Bakken (MVP)" <Torgeir.Bakken-spam@hydro.com> wrote in message
news:403E861A.F18FAA38@hydro.com...
> j wrote:
>
> > (snip)
> > 'oFS.CopyFile "F:\getlist\metapad.exe" ,"\\" & sComputer &
> > "\d$\Docume~1\Alluse~1\Desktop"
>
> Hi
>
> In the line above, you are trying to overwrite the actual folder "Desktop"
> with the file "metapad.exe", that will fail fore sure. Try this instead:
>
> oFS.CopyFile "F:\getlist\metapad.exe" , _
> "\\" & sComputer & "\d$\Docume~1\Alluse~1\Desktop\"
>
>
> (note the trailing backslash behind Desktop)
>
> --
> torgeir
> Microsoft MVP Scripting and WMI, Porsgrunn Norway
> Administration scripting examples and an ONLINE version of the 1328 page
> Scripting Guide: http://www.microsoft.com/technet/scriptcenter
>
>