MSFN Forum: VBscript to move from one server to next. - MSFN Forum

Jump to content


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

VBscript to move from one server to next. Need script help Rate Topic: -----

#1 User is offline   freedavis 

  • Group: Members
  • Posts: 1
  • Joined: 13-December 12
  • OS:none specified
  • Country: Country Flag

Posted 13 December 2012 - 08:49 AM

I have the below vbscript and need to add a line to be able to move this to three servers. Any help appreciated on this questions.

Set FSO =CreateObject("scripting.FileSystemObject")
FSO.CopyFolder "C:\inetpub\wwwroot\Pre-Release\*", "C:\inetpub\wwwroot\ErOne" ,True
FSO.CopyFile "C:\inetpub\wwwroot\Pre-Release\*", "C:\inetpub\wwwroot\ErOne", True
MsgBox"Deployment completed, Goodbye", vbInformation, "Script Informer"

This vbscript when executed, copied entire folder content from pre-release folder to the ErOne folder.

Is there a way edit this script to do this on two others servers from one server? Would like to be able to execute this on one server and it pushes to two other servers also.

This post has been edited by freedavis: 13 December 2012 - 08:53 AM



#2 User is offline   allen2 

  • Not really Newbie
  • PipPipPipPipPipPipPip
  • Group: Members
  • Posts: 1,737
  • Joined: 13-January 06

Posted 13 December 2012 - 03:51 PM

This should work.
Set FSO =CreateObject("scripting.FileSystemObject")
'local deploy
FSO.CopyFolder "C:\inetpub\wwwroot\Pre-Release\*", "C:\inetpub\wwwroot\ErOne" ,True
FSO.CopyFile "C:\inetpub\wwwroot\Pre-Release\*", "C:\inetpub\wwwroot\ErOne", True
'remote server1 deploy
FSO.CopyFolder "C:\inetpub\wwwroot\Pre-Release\*", "\\server1\C$\inetpub\wwwroot\ErOne" ,True
FSO.CopyFile "C:\inetpub\wwwroot\Pre-Release\*", "\\server1\C$\inetpub\wwwroot\ErOne", True
'remote server2 deploy
FSO.CopyFolder "C:\inetpub\wwwroot\Pre-Release\*", "\\server2\C$\inetpub\wwwroot\ErOne" ,True
FSO.CopyFile "C:\inetpub\wwwroot\Pre-Release\*", "\\server2\C$\inetpub\wwwroot\ErOne", True

MsgBox"Deployment completed, Goodbye", vbInformation, "Script Informer"



#3 User is offline   gunsmokingman 

  • MSFN Master
  • Group: Super Moderator
  • Posts: 2,352
  • Joined: 02-August 03
  • OS:none specified
  • Country: Country Flag

Posted 13 December 2012 - 05:19 PM

Using allen2 example path here is another way using an array and a loop

Dim Fso :Set Fso = CreateObject("Scripting.FileSystemObject")
Dim FPath, Obj, SvrPath 
'->Array For Path To Local And Server Folders
SvrPath = Array("C:\inetpub\wwwroot\ErOne", _
                "\\server1\C$\inetpub\wwwroot\ErOne", _
                "\\server2\C$\inetpub\wwwroot\ErOne")                
'-> Copy This 
 FPath = "C:\inetpub\wwwroot\Pre-Release\*"                 
'-> Loop Threw The Array         
     For Each Obj In SvrPath
'-> Code For Copy
    Fso.CopyFolder FPath, Obj ,True
    Fso.CopyFile FPath, Obj, True
'-> UnComment For Out Put
'     WScript.Echo "Fso.CopyFolder " & FPath & ", " & Obj & ",True" & _
'         vbCrLf & "Fso.CopyFile " & FPath & ", " & Obj & ",True" & vbCrLf
     Next



Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users



All trademarks mentioned on this page are the property of their respective owners
Copyright © 2001 - 2013 msfn.org
Privacy Policy