Script to Install Microsoft Updates [Security Patches] Automatically From a Folder
Microsoft releases security patches [operating system as well as application updates] on second Tuesday of every month. Not all security patches are applicable in your environment. Only approved security patches need to be updated on the machines.
When it comes to Application Packaging, the work stations on which packaging and testing is carried out should be updated with these security patches in sync with production. These workstation builds [gold builds] should be regularly patched with approved security patches in the environment.
These security patches will be in the form of EXE, MSU, MSP and CAB files. If you do not have a distribution mechanism to update the packaging and testing work station then this script will help you installing the security patches automatically.
You just need to download all the patches required to install and copy them into a folder. Once the security patches are available in the folder then specify the folder path in the script as below:
spPatchFolder = "C:\Patches"
Save the script and execute. This script automatically picks up the file extensions in the folder specified above and install them automatically using silent command line switches. The script also creates a log file [MicrosoftUpdatesInstall.log] in the same folder as the script. You can review what file has been executed and you can also see if the execution is successful. If the execution is not successful then you can even see the EXIT CODE there in the log file.
A sample log file is as below:
4/5/2013 12:16:53 AM
"C:\Patches\setup.exe" installation failed. Exit Code: 1
"C:\Patches\1\setup.exe" installation failed. Exit Code: 1
Attached please find the script as a text file. Remove the extension to save as vbscript to execute.Please note that the script is also capable of searching through subfolders under the specified folder [recursive folder search].
I hope this helps.