' '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' URL ListDim urls(3)urls(1)="https://portal/sites/project1"urls(2)="https://portal/sites/project2"urls(3)="https://portal/sites/project3"Dim servers(2)servers(1) = "server1"servers(2) = "server2"Dim PingReplyPingReply = "Reply from"Dim TargetUrlTargetUrl = "portal"Dim outFileoutFile="c:\WarmUp\WarmUp2013.log"' ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''On error resume next' '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Codedim fsodim startTimestartTime = Now'DeleteLogAddToLog "------------------------------------------------"set fso = CreateObject("Scripting.FileSystemObject")For Each server in servers If server <> "" Then AddToLog "---------------- " & UCase(server) hostfile = "C:\Windows\System32\drivers\etc\hosts-" & server fso.CopyFile hostfile, "C:\Windows\System32\drivers\etc\hosts" PingResult TargetUrl WarmUp() End IfNextAddToLog "---------------- RESET"fso.CopyFile "C:\Windows\System32\drivers\etc\hosts-original", "C:\Windows\System32\drivers\etc\hosts"PingResult TargetUrlset fso = NothingAddToLog "---------------- Summary"minTime = UBound(urls) * UBound(servers) * 5duration = datediff("s", startTime, now)AddToLog "URLs: " & UBound(urls)AddToLog "Minimal Time: " & minTimeAddToLog "Duration (s): " & durationIf duration > (minTime + 5) Then AddToLog "Warning!"End IfAddToLog "------------------------------------------------"' '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Subssub WarmUp() dim ie set ie = CreateObject("InternetExplorer.Application") ie.Visible = 0 For Each u1 In urls if u1 <> "" then AddToLog u1 ie.Navigate2 u1 WScript.Sleep(5000) Do while IE.readystate <> 4 loop end if Next ie.Quit set ie = Nothingend subsub DeleteLog() outFile="c:\svn\WarmUp2013.log" Set objFSOFile=CreateObject("Scripting.FileSystemObject") objFSOFile.DeleteFile outFileend subsub AddToLog(txt) set objFSOFile=CreateObject("Scripting.FileSystemObject") set objFile = objFSOFile.OpenTextFile(outFile, 8, True) objFile.Write Now & " - " & txt & vbCrLf objFile.Close wscript.echo txtend subsub PingResult(host) dim objShell dim objExec set objShell = CreateObject("WScript.Shell") set objExec = objShell.Exec("ping -n 1 -w 1000 " & host) pr = objExec.StdOut.ReadAll pr = mid(pr, InStr(pr, PingReply)) pr = left(pr, InStr(pr, ":") - 1) AddToLog pr set objShell = Nothing set objExec = Nothingend sub