Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Install Windows Management Framework core package
Set updateSession = CreateObject("Microsoft.Update.Session")
Set updateSearcher = updateSession.CreateupdateSearcher()
Set searchResult = updateSearcher.Search("IsInstalled=0 and Type='Software'")
Set toDL = CreateObject("Microsoft.Update.UpdateColl")
For I = 0 To searchResult.Updates.Count-1
Set update = searchResult.Updates.Item(I)
For kbidindex = 0 to update.KBArticleIDs.Count-1
kbid = update.KBArticleIDs.Item(kbidindex)
If kbid = "968930" or kbid = "951847" Then
End If
If toDL.Count = 0 Then
Set WshShell = wscript.createobject("")
WshShell.Run "%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe ""Enable-PSRemoting -Force""", 1, True
WScript.Quit -1
End If
Set DLer = updateSession.CreateUpdateDownloader()
DLer.Updates = toDL
DLdone = False
allDone = True
For I = 0 to toDL.Count - 1
Set update = toDL.Item(I)
allDone = allDone and update.IsDownloaded
DLdone = allDone
WScript.Sleep 5000
Loop Until DLdone
Set installer = updateSession.CreateUpdateInstaller()
installer.Updates = toDL
Set installationResult = installer.Install()
Set WshShell = wscript.createobject("")
WshShell.Run "%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe ""Enable-PSRemoting -Force""", 1, True
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.