Option Explicit ' Oggetti globali Dim oShell,oShApp,oFSO Set oShell = WScript.CreateObject("WScript.Shell") Set oShApp = CreateObject("Shell.Application") Set oFSO = CreateObject("Scripting.FileSystemObject") ' Main Sub Main() Dim sTmpFile,sIp,s,f ' Rilancio con privilegi elevati per bypassare UAC If WScript.Arguments.length=0 Then oShApp.ShellExecute "wscript.exe", """" & WScript.ScriptFullName & """ uac", "", "runas", 1 Exit Sub End If ' Get interface name sTmpFile = oShell.ExpandEnvironmentStrings("%TMP%\vpn.txt") oShell.Run "cmd /c ipconfig > " & sTmpFile, 0, True sIp = "" Set f = oFSO.OpenTextFile(sTmpFile) Do Until f.AtEndOfStream s = f.Readline If Left(s,11) = "Scheda PPP " Or Left(s,12) = "PPP adapter " Then s = f.Readline s = f.Readline s = f.Readline If Left(s,43) = " Indirizzo IPv4. . . . . . . . . . . . : " Then sIp = Mid(s,44) ElseIf Left(s,39) = " IPv4 Address. . . . . . . . . . . : " Then sIp = Mid(s,40) Else WScript.Echo "Errore formato scheda PPP" Exit Sub End If Exit Do End If Loop f.Close() If sIp = "" Then WScript.Echo "VPN non connessa" Exit Sub End If oShell.Run "cmd /c route add 192.84.143.144 mask 255.255.255.255 " & sIp, 0, True oShell.Run "cmd /c route add 131.154.52.47 mask 255.255.255.255 " & sIp, 0, True oShell.Run "cmd /c route add 131.154.52.48 mask 255.255.255.255 " & sIp, 0, True oShell.Run "cmd /c route add 193.206.84.55 mask 255.255.255.255 " & sIp, 0, True WScript.Echo "VPN abilitata per utilizzare i server di licenza" End Sub Call Main()