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 Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s