$SO=SetOption("Explicit", "ON")
$SO=SetOption("NoMacrosInStrings", "ON")
$SO=SetOption("NoVarsInStrings", "ON")
$SO=SetOption("WrapAtEOL", "ON")
; Variable Declarations
Dim $o_Server,$a_Sites,$s_Counter,$s_Site,$s_Events
; Instatiate the SFTP COM Object
$o_Server = CreateObject(SFTPCOMInterface.CIServer)
; Connect to the server
$o_Server.Connect('10.10.0.23','3000','admin','password')
; Retrieve a list of Sites
$a_Sites=$o_Server.Sites
; See if the Site is stopped, if not Stop it
For $s_Counter = 0 to UBound($a_Sites)
$s_Site = $o_Server.Sites.Item($s_Counter)
If $s_Site.IsStarted = 'True'
$s_Site.Stop()
EndIf
Next
; Stop the EFT Server Service
Shell '%comspec% sc \\server stop "GlobalScape EFT Server"'
; Wait for the service to stop
While WMIService("GlobalScape EFT Server","Query",,"\\server") <> "Stopped"
Loop
; Create backup of config on Server01 and Server02 to the DFS mount
Copy "\\server\e$\Globalscape\ftp.dat" "\\server03\eftdata\eftconfig\server_config\ftp_"+Join(Split(@DATE,"/"))+".bak"
Copy "\\server01\e$\Globalscape\ftp.dat" "\\server03\eftdata\eftconfig\server01_config\ftp_"+Join(Split(@DATE,"/"))+".bak"
; Overwrite the config on Server with the Master copy
Copy "\\server01\e$\globalscape\ftp.dat" "\\server\e$\globalscape\"
; Start the EFT Server Service
Shell '%comspec% sc \\server start "GlobalScape EFT Server"'
; Wait for the service to start
While WMIService("GlobalScape EFT Server","Query",,"\\server") <> "Running"
Loop
; Stop any sites that came up running
For $s_Counter = 0 to UBound($a_Sites)
$s_Site = $o_Server.Sites.Item($s_Counter)
If $s_Site.IsStarted = 'True'
$s_Site.Stop()
EndIf
Next
; Change the IP's to the correct one for each site.
For $s_Counter = 0 to UBound($a_Sites)
$s_IP = ReadProfileString("\\server03\eftdata\eftconfig\globalscape\config.ini","Sites",$a_Sites[$s_Counter])
$s_Site = $o_Server.Sites.Item($s_Counter)
$s_Site.SetIP("10.10.0."+$s_IP)
; Need to find a way to change the gateway address as well
; Turn off all the event rules
$s_Events = $s_Site.
Next
Function WMIService($service,$action,optional $startmode,optional $computer)
;Removed to make a shorter post