Re: VBScript That Copies Folder Content To Remote Computers by Monte
Monte
Tue Dec 19 13:41:14 CST 2006
I have one too that I can share with you.
On Error Resume Next
Const ForReading = 1
Const OverwriteExisting = TRUE
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.OpenTextFile("c:\Shoretel\server.txt", ForReading)
Do Until objTextFile.AtEndOfStream
strComputer = objTextFile.Readline
If objFSO.FileExists("\\" & strcomputer & "\support\Shoretel\scmsetup.exe")
Then
Set objFolder = objFSO.GetFile("\\" & strcomputer &
"\support\Shoretel\scmsetup.exe")
Else
Set objFolder = objFSO.CreateFolder("\\" & strcomputer &
"\Support\shoretel")
objFSO.CopyFile "c:\Shoretel\scmsetup.exe" , "\\" & strcomputer &
"\support\Shoretel\", OverwriteExisting
end if
wscript.echo strcomputer & " done"
Loop
wscript.echo "all finished"
objTextFile.Close
This One Reads a file of the remote servers that you have put in a text file
(server.txt) and then it reads them one at a time. it then goes through and
checks to see if the file exist and if not then it creates the folder and
copies the file to it. it will then echo a dos screen that gives the
computer name and that it has finished its copy to that server and then when
it finishs all the servers in the text file it echos all finished.
Hope this one helps as well,
Monte(monte.bratschi@thyssenkrupp.com)
"Baard Schøyen" <BaardSchyen@discussions.microsoft.com> wrote in message
news:D0422C2E-E927-45CF-A8F2-A3BA0B0EA8E7@microsoft.com...
> Hello!
>
> Try this:
>
> --
>
> Dim oFSO
> Dim RFOL, LFOL
>
> '** Objects:
> Set oFSO = Wscript.CreateObject("Scripting.FileSystemObject")
>
> '** Statements:
> RFOL = "\\RemoteComputer\testfol" ' - Remote folder.
> LFOL = "C:\Scripting\testfol" ' - Local folder.
>
> '** Operation:
> If oFSO.FolderExists(RFOL) Then
> msgbox RFOL & " already exists."
> Wscript.Quit
> Else
> msgbox RFOL & " does not exist. Press Ok to copy."
> oFSO.CopyFolder LFOL , RFOL, True
> msgbox "Copy completed"
> End If
>
> --
> Regards,
> Baard Schøyen
>
>
> "obagasha@gmail.com" wrote:
>
>> Is anyone that can help me? I trying to create a VBScript copy folder
>> to remote computer. I would like the VBScript that check to see if that
>> folder I want to copy already exist on a remote computer, If the folder
>> exists, then I would like the VBScript to move on the next computer,
>> and if the folder doesn't exist I would like it to copy the folder to
>> that remote computer and possible create a log file telling me which
>> computers completed successfully and which ones didn't
>>
>>