Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

VBScript That Copies Folder Content To Remote Computers

1,460 views
Skip to first unread message

obag...@gmail.com

unread,
Dec 10, 2006, 8:24:26 PM12/10/06
to
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

Baard Schøyen

unread,
Dec 12, 2006, 8:06:01 AM12/12/06
to
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

JerryMac12

unread,
Dec 12, 2006, 8:15:18 AM12/12/06
to
Also, make sure you are running the script using an ID that has the
proper rights to write the folder to the remote computer.

Monte Bratschi

unread,
Dec 19, 2006, 2:41:14 PM12/19/06
to
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.b...@thyssenkrupp.com)

"Baard Schøyen" <Baard...@discussions.microsoft.com> wrote in message
news:D0422C2E-E927-45CF...@microsoft.com...

0 new messages