script to copy file to multiple computers

  • Thread starter Thread starter wuzzle
  • Start date Start date
W

wuzzle

I can't see what I am doing wrong. I modified this script that I
found on MS web site

Const ForReading = 1
Const OverwriteExisting = TRUE

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile("C:\Scripts\Computers.txt")

Do Until objFile.AtEndOfStream
strComputer = objFile.ReadLine
strRemoteFile = "\\" & strComputer & "\C$\windows
\system32\winexit.scr"
objFSO.CopyFile "C:\Program Files\Windows Resource Kits\Tools
\winexit.scr", strRemoteFile, OverwriteExisting
Loop
 
wuzzle said:
I can't see what I am doing wrong. I modified this script that I
found on MS web site

Const ForReading = 1
Const OverwriteExisting = TRUE

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile("C:\Scripts\Computers.txt")

Do Until objFile.AtEndOfStream
strComputer = objFile.ReadLine
strRemoteFile = "\\" & strComputer & "\C$\windows
\system32\winexit.scr"
objFSO.CopyFile "C:\Program Files\Windows Resource Kits\Tools
\winexit.scr", strRemoteFile, OverwriteExisting
Loop

If you're not familiar with VB Scripts, why don't you keep things simple and
use a batch file instead? It would give you much clearer error messages too.
Here is one that would do the trick:

@echo off
set src=C:\Program Files\Windows Resource Kits\Tools
for /F %%a in (c:\Scripts\Computers.txt) do (
copy "%src%\winexit.scr" \\%%a\c$\windows\system32\
)
 
Back
Top