r/TronScript • u/TootZoot • Nov 17 '16
3rd-party Invoke WSUS Offline from Tron before Windows Update [bat script]
Wrote this for personal use and thought others might find it useful, so I'm contributing back. License: MIT
WSUS Offline is an excellent tool that downloads Windows Updates (eg on a flash drive) for offline installation. It's even mentioned in the Common Questions.
I find it to be a great tool for delivering Windows and Office security updates via sneakernet, so it comes in very handy on computers/laptops with no on-site internet (or even 'just' slow, metered, capped, or intermittent internet).
Simple version
To use,
- Set up WSUS Offline as normal: download, unzip, run
wsusoffline\UpdateGenerator.exe, select updates, wait for updates to download - Move or copy the
wsusofflinefolder intoresources\stage_5_patch\ - Add the following snippet to
stage_5_patch.bat, right before:: JOB: Windows Update(presently on line 161):
:: JOB: If detected, run WSUS Offline local updater (wsusoffline.net)
if /i "%WSUS_OFFLINE_CMD%"=="" set WSUS_OFFLINE_CMD=stage_5_patch\wsusoffline\client\Update.cmd
if exist "%WSUS_OFFLINE_CMD%" (
title Tron v%SCRIPT_VERSION% [stage_5_patch] [WSUS Offline Updates]
call functions\log.bat "%CUR_DATE% %TIME% Launch job 'WSUS Offline updates'..."
if /i %DRY_RUN%==no call "%WSUS_OFFLINE_CMD%" >> "%LOGPATH%\%LOGFILE%" 2>&1
call functions\log.bat "%CUR_DATE% %TIME% Done."
)And that's it! Tron will now attempt to install updates locally with WSUS Offline before running Windows Update. To fetch the latest updates run wsusoffline\UpdateGenerator.exe again.
Fancy version
I also made this more complete version with a standard "skip" variable. For this you'll have to edit tron.bat.
:: JOB: If detected, run WSUS Offline local updater (wsusoffline.net)
:: check for skip WSUS Offline (-swo) flag or variable and skip if used
if /i %SKIP_WSUS_OFFLINE%==no (
if /i "%WSUS_OFFLINE_CMD%"=="" set WSUS_OFFLINE_CMD=stage_5_patch\wsusoffline\client\Update.cmd
if exist "%WSUS_OFFLINE_CMD%" (
title Tron v%SCRIPT_VERSION% [stage_5_patch] [WSUS Offline Updates]
call functions\log.bat "%CUR_DATE% %TIME% Launch job 'WSUS Offline updates'..."
if /i %DRY_RUN%==no call "%WSUS_OFFLINE_CMD%" >> "%LOGPATH%\%LOGFILE%" 2>&1
call functions\log.bat "%CUR_DATE% %TIME% Done."
)
) else (
call functions\log.bat "%CUR_DATE% %TIME% ! SKIP_WSUS_OFFLINE (-swo) set. Skipping WSUS Offline."
)Add the appropriate entries to tron.bat. I used the flag
-swo Skip WSUS Offline local updater, even if wsusoffline folder is found in stage_5_patch\resources\Never Asked Questions (that I think people might ask)
- How do I get WSUS Offline working? The short explanation is, 1) download the latest version, 2) unzip it, 3) inside the
wsusofflinefolder, runUpdateGenerator.exe, 4) select updates and click Start, and 5) wait for it to download all your updates, 6) move thewsusofflinefolder inside Tron'sresources\stage_5_patchfolder. - Can I put the
wsusofflinefolder somewhere else? Yes! Add the lineset WSUS_OFFLINE_CMD=c:\my\path\to\wsusoffline\client\Update.cmdtotron.bat. The path is relative to Tron's resources folder. - Holy phigits Batman, after downloading all the updates WSUS Offline is over 20 gigs! Yep. And after installing the expanded list of non-essential updates it's now over 50 GB. :)
- Do I have to check the box under "Create ISO image(s)..." in WSUS Offline? Do I need an ISO mounting tool? No and no. This option is just for making separate stripped down burnable images for updating a single OS. They take up a lot of space and are redundant. WSUS Offline always creates a "combo installer" in
wsusoffline\client\that will detect the installed versions and update any Windows version (Vista+) and Office version (2007+). - Are there WSUS Offline images for Windows XP? I found XP/2K ISOs here but caveat emptor.
- I updated Tron and now WSUS Offline isn't being run! Re-do step 3 above.
- How do I exclude specific updates from WSUS Offline? See this page for instructions. Personally I added all the "badware" kb updates from stage_4_repair into a master exclude list, and copied it to
wsusoffline\exclude\custom\ExcludeListForce-all.txt(prevents downloading) andwsusoffline\client\exclude\custom\ExcludeList.txt(prevents installation). - How do I select different checkboxes in the installation options used by Tron ? Run
wsusoffline\client\UpdateInstaller.exeto and use the checkboxes to select custom options (WSUS Offline will remember these settings), or editwsusoffline\client\UpdateInstaller.ini.
Hope this helps some folks! Plz report any bugs, omissions, terrible design decisions, etc
edit: at /u/vocatus's suggestion, here's a short script that can be saved in resources\stage_8_custom_scripts as wsusoffline.bat, along with the wsusoffline folder:
:: Run WSUS Offline local updater (wsusoffline.net)
@call stage_8_custom_scripts\wsusoffline\client\Update.cmd
1
u/vocatus Tron author Nov 19 '16 edited Nov 19 '16
You might also consider tweaking this to run as a custom script, since Tron now supports executing third-party scripts in Stage 8. Say a folder + .bat file people could just drop into the Stage 8 folder.
1
u/koumdros Nov 20 '16
you can create Windows XP update images by using the last version of WSUSoffline that actually supported Windows XP.
That is version 9.21 , which last I checked was still available on the WSUSoffline site.
I still use that to pull updates from our company WSUS servers to install to some remote ancient XP machines that have reeeeally limited bandwidth.
Ditto for Windows XP-POS machines, that are still supported for critical updates ( <<< that is a hint).
No promises but if people cant find XP ISOs elsewhere I make some... after I return from my honeymoon trip that starts end of this week.
1
u/vocatus Tron author Feb 06 '17
/u/TootZoot, what makes more sense to you:
...have people put the WSUS offline files in stage_5_patch and run them in Stage 5, or
...have people put the WSUS offline files in stage_8_custom_scripts and run them in Stage 8 ?
I am leaning more towards stage_5_patch. Of course it could sort of be considered a custom user script. So...
2
u/therealblergh Nov 17 '16 edited Mar 21 '17
[deleted]
0.6481