VBscript to copy file to the remote computers

Below is the VB script to copy a file from local computer to list of remote computers

On Error Resume Next
Const ForReading = 1
Set objFSO = CreateObject(“Scripting.FileSystemObject”)
Set objTextFile = objFSO.OpenTextFile(“C:\server.txt”, ForReading)

Do Until objTextFile.AtEndOfStream
 strComputer = objTextFile.Readline
        objFSO.CopyFile “C:\regsetting.bat” , “\\” & strcomputer & “\C$\”
        wscript.echo strcomputer & ” Copied”
Loop

One thought on “VBscript to copy file to the remote computers

  1. It works!
    I just added a line under
    Const ForReading = 1
    Const OverWriteExisting = TRUE

    and
    objFSO.CopyFile “C:\regsetting.bat” , “\\” & strcomputer & “\C$\” , OverWriteExisting

    Thanks.

Leave a comment