Force Windows Update Check and Download


Here’s a short script that forces a windows update check on the machine you’re on and downloads any remaining updates. Useful if you don’t feel like waiting…


Set fso = CreateObject("Scripting.FileSystemObject") 
Set objAutomaticUpdates = CreateObject("Microsoft.Update.AutoUpdate") objAutomaticUpdates.EnableService 
objAutomaticUpdates.DetectNow 

Set objSession = CreateObject("Microsoft.Update.Session") 
Set objSearcher = objSession.CreateUpdateSearcher() 
Set objResults = objSearcher.Search("IsInstalled=0 and Type='Software'") 
Set colUpdates = objResults.Updates 

Set objUpdatesToDownload = CreateObject("Microsoft.Update.UpdateColl") intUpdateCount = 0 

For i = 0 to colUpdates.Count - 1 
        intUpdateCount = intUpdateCount + 1 
        Set objUpdate = colUpdates.Item(i) 
        objUpdatesToDownload.Add(objUpdate) 
Next 

This is part of a script from this post.

Advertisements
Tagged ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: