Skip to content

Instantly share code, notes, and snippets.

View Aquiles1976's full-sized avatar

Aquiles1976

View GitHub Profile
@nicholasdille
nicholasdille / Install-WindowsUpdate.vbs
Created September 8, 2015 08:10
Installs Windows Updates asynchronously and displays progress
Set wshShell = WScript.CreateObject("WScript.Shell")
strComputerName = wshShell.ExpandEnvironmentStrings("%ComputerName%")
Set updateSession = CreateObject("Microsoft.Update.Session")
WScript.StdOut.WriteLine "Activity=""Processing Windows Updates on " & strComputerName & """ Status=""Searching for updates"" Percentage=0"
Set SearchResult = Search
WScript.StdOut.WriteLine "Activity=""Processing Windows Updates on " & strComputerName & """ Status=""Searching for updates"" Percentage=100"
WScript.StdOut.WriteLine "SearchResultCode=" & SearchResult.ResultCode
WScript.StdOut.WriteLine "UpdatesFound=" & SearchResult.Updates.Count