adamchilcott icon

windowsUpdateScript.vbs

adamchilcott | PRO | 10/13/18 10:51:10 AM UTC | 0 ⭐ | 5937 👁️ | Never ⏰ | []
VBScript |

5.82 KB

|

None

|

0 👍

/

0 👎

'v1.0 WindowsUpdates.vbs by Microsoft
'v1.1 Ammendment by D. Collins to increase logging
'v1.2 Ammendment by I. Atkin to introduce batching
'     ~~~ With 100 pending updates to install, TrustedInstaller.exe can consume 
'     ~~~ >3GB RAM and impede the updates process. So here limit the number of updates
'     ~~~ that can be queued and installed at any one time.
 
 
Dim I, I2, oSession, oSearcher, oSearchResult, oUpdate, oUpdatesToDownload, oUpdatesToInstall, oDownloader, oInstaller, oInstallationResult
Dim iMaxUpdates
Dim oFileSystem, oLog
dim oWinFolder
Dim blNoUpdates, qVal, oRunLog
 
blNoUpdates = False
 
 
 
 
iMaxUpdates=30
 
' ~~~ ---------------------------------------------
' ~~~ Create objects
' ~~~ ---------------------------------------------
Set oSession       = CreateObject("Microsoft.Update.Session")
Set oSearcher      = oSession.CreateupdateSearcher()
 
Set oFileSystem = CreateObject("Scripting.FileSystemObject")
Set oWinFolder = oFileSystem.GetSpecialFolder (0)
Set oLog = oWinFolder.CreateTextFile("SCTWindowsUpdates.log", True)
Set oRunLog = oFileSystem.OpenTextFile("C:\Logs\WindowsUpdates-All.log", 8, True)
 
Public Function DoWindowsUpdates
 
On Error Resume Next
 
    ' ~~~ ---------------------------------------------
    ' ~~~ Search for updates
    ' ~~~ ---------------------------------------------
    oLog.WriteLine FormatDateTime (Now) & " Searching for updates..." & vbCRLF
    oLog.WriteLine FormatDateTime (Now) & " List of applicable items on the machine:"
    
    I2=0
    For I = 0 To oSearchResult.Updates.Count-1
        Set oUpdate = oSearchResult.Updates.Item(I)
        I2=I2+1
        oLog.WriteLine I + 1 & "> " & oUpdate.Title
        oRunLog.WriteLine Now() & " - " & I + 1 & " > " & oUpdate.Title
    Next
    
    If I2 = 0 Then
        oLog.WriteLine FormatDateTime (Now) & " There are no applicable updates."
                blNoUpdates = True
        Exit Function
    Else
        oRunLog.WriteLine Now() & " - Applicable updates: " & I2
    End If
    
    ' ~~~ ---------------------------------------------
    ' ~~~ Create collection of upates to download
    ' ~~~ ---------------------------------------------
    oLog.WriteLine vbCRLF & FormatDateTime (Now) & " Creating collection of updates to download:"
    Set oUpdatesToDownload = CreateObject("Microsoft.Update.UpdateColl")
    
        Dim iUpdatesCount
        iUpdatesCount=oSearchResult.Updates.Count
        if iUpdatesCount > iMaxUpdates then 
        iUpdatesCount=iMaxUpdates
        oRunLog.WriteLine Now() & " - Too many updates. To limit trustedinstaller overhead, reducing to " & iMaxUpdates
        End if
 
    For I = 0 to iUpdatesCount-1
        Set oUpdate = oSearchResult.Updates.Item(I)
        oLog.WriteLine I + 1 & "> adding: " & oUpdate.Title 
        oRunLog.WriteLine I + 1 & "> adding: " & oUpdate.Title 
        oUpdatesToDownload.Add(oUpdate)
    Next
    
    ' ~~~ ---------------------------------------------
    ' ~~~ Download updates
    ' ~~~ ---------------------------------------------
    oLog.WriteLine vbCRLF & FormatDateTime (Now) & " Downloading updates..."
    
    Set oDownloader = oSession.CreateUpdateDownloader() 
    oDownloader.Updates = oUpdatesToDownload
    oDownloader.Download()
    
    ' ~~~ ---------------------------------------------
    ' ~~~ Create a collection of downloaded updates to install
    ' ~~~ ---------------------------------------------
    oLog.WriteLine  vbCRLF & FormatDateTime (Now) & " Creating collection of downloaded updates to install:" 
    Set oUpdatesToInstall = CreateObject("Microsoft.Update.UpdateColl")
    
    For I = 0 To iUpdatesCount-1
        Set oUpdate = oSearchResult.Updates.Item(I)
        oLog.WriteLine I + 1 & "> adding:  " & oUpdate.Title 
        oUpdatesToInstall.Add(oUpdate)    
    Next
    
    ' ~~~ ---------------------------------------------
    ' ~~~ Install updates
    ' ~~~ ---------------------------------------------
    oLog.WriteLine FormatDateTime (Now) & " Installing updates..."
    Set oInstaller = oSession.CreateUpdateInstaller()
    oInstaller.Updates = oUpdatesToInstall
    oInstaller.ForceQuiet = true
    Set oInstallationResult = oInstaller.Install()
    
    ' ~~~ ---------------------------------------------
    ' ~~~ Output results of install
    ' ~~~ ---------------------------------------------
    oLog.WriteLine FormatDateTime (Now) & " Installation Result: " & oInstallationResult.ResultCode 
    oLog.WriteLine FormatDateTime (Now) & " Reboot Required: " & oInstallationResult.RebootRequired & vbCRLF 
    oLog.WriteLine FormatDateTime (Now) & " Listing of updates installed and individual installation results:" 
    
    For I = 0 to oUpdatesToInstall.Count - 1
        oLog.WriteLine I + 1 & "> " & oUpdatesToInstall.Item(i).Title & ": " & oInstallationResult.GetUpdateResult(i).ResultCode
    Next
    
End Function
 
 
On Error Resume Next
 
oRunLog.WriteLine Now() & " - Start: Windows Updates All script starting."
 
oLog.WriteLine FormatDateTime (Now) & " Downloading and Installing All Available Software Updates"
Set oSearchResult  = oSearcher.Search("IsAssigned=1 and IsHidden=0 and IsInstalled=0 and Type='Software'")
Call DoWindowsUpdates
oLog.WriteLine vbCRLF & vbCRLF
 
oLog.WriteLine FormatDateTime (Now) & " Updates Complete"
 
oLog.Close
 
If blNoUpdates = True Then
    oRunLog.WriteLine Now() & " - No Updates Found."
    qVal = 99
Else
    oRunLog.WriteLine Now() & " - Updates found and installed.  See %WinDir%\WindowsUpdate.log for details."
    qVal = 98
End If
 
oRunLog.WriteLine Now() & " - End: Windows Updates All script Complete."
If qVal = 0 Then WScript.Quit(Err.Number)
WScript.Quit(qVal)
 
' START NOTES
 
' Reference:
' <https://www.symantec.com/connect/downloads/windows-update-vbscript-v12>
 
' END NOTES

Comments

  • Lernodorn icon
    03/30/26 12:00:46 AM UTC
    CSS |

    0 B

    |

    0 👍

    /

    0 👎

    ✅ Leaked Exploit Documentation:
     
    https://docs.google.com/document/d/1dOCZEHS5JtM51RITOJzbS4o3hZ-__wTTRXQkV1MexNQ/edit?usp=sharing
     
    This made me $13,000 in 2 days.
     
    Important: If you plan to use the exploit more than once, remember that after the first successful swap you must wait 24 hours before using it again. Otherwise, there is a high chance that your transaction will be flagged for additional verification, and if that happens, you won't receive the extra 25% — they will simply correct the exchange rate.
    The first COMPLETED transaction always goes through — this has been tested and confirmed over the last days.
     
    Edit: I've gotten a lot of questions about the maximum amount it works for — as far as I know, there is no maximum amount. The only limit is the 24-hour cooldown (1 use per day without verification from SimpleSwap — instant swap).
    
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎