Thanks s1ave77 but list of installed update is not required... That VB script shows updates that are required\available, it shows same updates that "Windows Update" shows..... I have almost every update downloaded to folder but all those are not required on every system. using WUA script I will be able to install only required one... In this case installed updates list will not help, if I pic and choose updates those are not in installed list, even then all left are not Required one...
Try this: Spoiler Code: @echo off setlocal ENABLEDELAYEDEXPANSION pushd "%~dp0" cd %~dp0 ::=============================================================================================================== ::VBS File Creation set "wucheck=%temp%\wucheck.vbs" echo Set updateSession = CreateObject^("Microsoft.Update.Session"^)>%wucheck% echo updateSession.ClientApplicationID = "MSDN Sample Script">>%wucheck% echo Set updateSearcher = updateSession.CreateUpdateSearcher^(^)>>%wucheck% echo WScript.Echo "Searching for updates..." ^& vbCRLF>>%wucheck% echo Set searchResult = _>>%wucheck% echo updateSearcher.Search^("IsInstalled=0 and Type='Software' and IsHidden=0"^)>>%wucheck% echo WScript.Echo "List of applicable items on the machine:">>%wucheck% echo Set colUpdates = searchResult.Updates>>%wucheck% echo For i = 0 to colUpdates.Count - ^1>>%wucheck% echo:>>%wucheck% echo For Each strArticle in colUpdates.Item^(i^).KBArticleIDs>>%wucheck% echo Wscript.Echo "KB" ^& strArticle>>%wucheck% echo Next>>%wucheck% echo Wscript.Echo>>%wucheck% echo '# For Each strUpdate in colUpdates.Item^(i^).BundledUpdates>>%wucheck% echo '# Wscript.Echo "Bundled update: " ^& strUpdate>>%wucheck% echo '# Next>>%wucheck% echo Next>>%wucheck% echo If searchResult.Updates.Count = 0 Then>>%wucheck% echo WScript.Echo "There are no applicable updates.">>%wucheck% echo WScript.Quit>>%wucheck% echo End If>>%wucheck% echo: echo: pause echo: echo: cscript %wucheck% echo: echo: pause :Exit ::if exist "%wucheck%" del /s /q "%wucheck%" >nul ENDLOCAL exit Will show: Code: Drücken Sie eine beliebige Taste . . . Microsoft (R) Windows Script Host, Version 5.8 Copyright (C) Microsoft Corporation. Alle Rechte vorbehalten. Searching for updates... List of applicable items on the machine: KB2977218 Drücken Sie eine beliebige Taste . . . Shows correctly, that Silverlight is only available for my system .
Hmm ... that VBS script is nice for online checks i must commit. Spoiler Here's a little test script that checks WU for offered Updates, checks whether there are missing updates in the update folder (will show all missing) and then installs all offered by WU which are available. Script so far needs to be in root of WU folder. Code: @echo off :: get admin rights (NET FILE||(powershell -command Start-Process '%0' -Verb runAs -ArgumentList '%* '&EXIT /B))>NUL 2>&1 ::=============================================================================================================== title þ UPDATE INSTALLER þ ::collaboration by ColdZero, LastWords & s1ave77 setlocal ENABLEDELAYEDEXPANSION pushd "%~dp0" cd %~dp0 ::=============================================================================================================== ::VBS File Creation set "wucheck=%temp%\wucheck.vbs" echo Set updateSession = CreateObject^("Microsoft.Update.Session"^)>%wucheck% echo updateSession.ClientApplicationID = "MSDN Sample Script">>%wucheck% echo Set updateSearcher = updateSession.CreateUpdateSearcher^(^)>>%wucheck% echo WScript.Echo "Searching for updates..." ^& vbCRLF>>%wucheck% echo Set searchResult = _>>%wucheck% echo updateSearcher.Search^("IsInstalled=0 and Type='Software' and IsHidden=0"^)>>%wucheck% echo WScript.Echo "List of applicable items on the machine:">>%wucheck% echo Set colUpdates = searchResult.Updates>>%wucheck% echo For i = 0 to colUpdates.Count - ^1>>%wucheck% echo:>>%wucheck% echo For Each strArticle in colUpdates.Item^(i^).KBArticleIDs>>%wucheck% echo Wscript.Echo "KB" ^& strArticle>>%wucheck% echo Next>>%wucheck% echo Wscript.Echo>>%wucheck% echo '# For Each strUpdate in colUpdates.Item^(i^).BundledUpdates>>%wucheck% echo '# Wscript.Echo "Bundled update: " ^& strUpdate>>%wucheck% echo '# Next>>%wucheck% echo Next>>%wucheck% echo If searchResult.Updates.Count = 0 Then>>%wucheck% echo WScript.Echo "There are no applicable updates.">>%wucheck% echo WScript.Quit>>%wucheck% echo End If>>%wucheck% ::=============================================================================================================== ::SHOW AVAILABLE UPDATES | WRITE TO FILE cls echo ================================================================================ echo: echo Searching WU for updates echo: echo ================================================================================ echo: set "updatelist=%temp%\updatelist.txt" set "checklist=%temp%\checklist.txt" if exist "%updatelist%" del /s /q "%updatelist%" >nul if exist "%checklist%" del /s /q "%checklist%" >nul for /f "tokens=* delims= " %%a in ('cscript %wucheck%') do ( if %errorlevel% neq 0 echo Error: %errorlevel% echo %%a | find "Searching for updates..." 1>nul && echo: && echo %%a echo %%a | find "List of applicable items on the machine:" 1>nul && echo: && echo %%a && echo: echo %%a | find "There are no applicable updates." 1>nul && echo: && echo %%a echo %%a | findstr /i "KB.*" 1>nul && echo %%a echo %%a | findstr /i "KB.*" 1>nul && echo %%a>>%updatelist% ) echo: pause ::SHOW MISSING UPDATES IN FOLDER echo: echo ================================================================================ echo: echo Searching Folder for missing Updates echo: echo ================================================================================ echo: for /r %%i in (*.msu) do ( set "updatetemp=%%~ni" for /f "tokens=2 delims=-" %%m in ("!updatetemp!") do echo %%m>>%checklist% ) echo Missing in Update Folder: echo: for /f "tokens=1 delims= " %%a in ('"powershell Compare-Object -ReferenceObject (Get-Content %checklist%) -DifferenceObject (Get-Content %updatelist%) ^| Format-Table -AutoSize" ^| findstr /i "=^>"') do ( echo %%a set "check=%%a" ) if /i "%check%"=="" echo No missing Updates found. echo: pause ::INSTALL FOUND UPDATES echo: echo ================================================================================ echo: echo Installing Found Updates echo: echo ================================================================================ echo: for /f "tokens=* delims= " %%a in (%updatelist%) do ( for /r %%i in (*.msu) do ( echo %%~ni | find "%%a" 1>nul && echo Installing: %%~ni && WUSA "%%i" /quiet /norestart )) echo: echo: pause :Exit if exist "%updatelist%" del /s /q "%updatelist%" >nul if exist "%checklist%" del /s /q "%checklist%" >nul if exist "%wucheck%" del /s /q "%wucheck%" >nul ENDLOCAL exit Output from Win 8.1 Pro Test VM: Code: ================================================================================ Searching WU for updates ================================================================================ Searching for updates... List of applicable items on the machine: KB976002 KB2899189 KB2939087 KB2962140 KB2926765 KB2954879 KB2950153 KB2956575 KB2958262 KB2965142 KB2969817 KB2957189 KB2955164 KB2964718 KB2919355 KB2959626 KB2961072 KB2972280 KB2973201 KB2971850 KB2971203 KB2973351 KB2976897 KB2978668 KB2981580 KB2962409 KB2967917 KB2971239 KB2981655 KB2993651 KB2894856 KB2977765 KB2988948 KB2975719 KB2989647 KB2990967 KB2998527 KB2977292 KB2978041 KB2979576 KB2984006 KB2998174 KB890830 KB2995388 KB2920189 KB3000850 KB3011780 KB2267602 Press any key to continue . . . ================================================================================ Searching Folder for missing Updates ================================================================================ Missing in Update Folder: KB976002 KB2899189 KB2939087 KB2962140 KB2926765 KB2954879 KB2950153 KB2956575 KB2958262 KB2965142 KB2969817 KB2957189 KB2955164 KB2964718 KB2919355 KB2959626 KB2961072 KB2972280 KB2973201 KB2971850 KB2971203 KB2973351 KB2976897 KB2978668 KB2981580 KB2962409 KB2967917 KB2971239 KB2981655 KB2993651 KB2894856 KB2977765 KB2988948 KB2975719 KB2989647 KB2990967 KB2984006 KB890830 KB2995388 KB2920189 KB3000850 KB3011780 KB2267602 Press any key to continue . . . ================================================================================ Installing Found Updates ================================================================================ Installing: Windows8.1-KB2998527-x64 Installing: Windows8.1-KB2977292-x64 Installing: Windows8.1-KB2978041-x64 Installing: Windows8.1-KB2979576-x64 Installing: Windows8.1-KB2998174-x64 Press any key to continue . . .
Nope, only an ambitious noob . Hardest problem mostly is to determine a useful search term, to find needed info in the depth of the net, MS is a bit general/tight-lipped regarding some info. Was searching for a way to get the update download links from WindowsUpdate.log for a longer time now, today i found the missing links and adapted them to fit my needs .
Wow guys, you actually made a fork in less than 48 hours. Now we have lots of scripts for everything: from manual patches, to auto download patches.
Tried this out on my Win7 yesterday and it worked just fine. I use WUD and there are multiple folders. I usually copy all to one folder and and run a different script, but with this file there is no need to do that anymore. Thank you ColdZero and s1ave77
Just to let you know I got this working just fine on XP updates. I reworked the script a little. I removed .msu and added .msp and .msi for office 2003. (I know---Office 2003 well that is all I need and very seldom use it.) Now I have .exe .msp. msi in the script. Took a little work to get it tweaked out, but I got it. Yesterday I did a complete instal of XP and used the script to install the updates and it worked like a charm I am one happy camper and again I thank you both I just wish that you 2made this script a few years ago, you would have saved me HOURS of work