Install Windows Updates via commandline (servers) interactive

Objective

  • Install windows updates via the commandline.

Solution

A default installation of Windows 2012 Server has this VB script.

c:\windows\System32\en-US\WUA_SearchDownloadInstall.vbs

 

You can copy this script to a Windows 2008 server and run it.
Copy and paste the line below in a cmd box or Powershell window.

cscript c:\windows\System32\en-US\WUA_SearchDownloadInstall.vbs

The script will ask for what kind of updates you want

Microsoft (R) Windows Script Host Version 5.8
Copyright (C) Microsoft Corporation. All rights reserved.
 
Search for for (A)ll updates or (R)ecommended updates only?

Then it will do it’s search

Searching for all applicable updates...
 
List of applicable items on the machine:
 
1> Update for Windows Server 2012 R2 (KB3146604)
2> Update for Windows Server 2012 R2 (KB3146978)
3> Update for Windows Server 2012 R2 (KB3103616)
4> Update for Windows Server 2012 R2 (KB3146751)
5> Update for Windows Server 2012 R2 (KB3145384)
6> Update for Windows Server 2012 R2 (KB3149157)
7> Update for Windows Server 2012 R2 (KB3125424)
8> Update for Windows Server 2012 R2 (KB3145432)
9> Update for Windows Server 2012 R2 (KB3103709)
10> Update for Windows Server 2012 R2 (KB3134179)
11> Update for Windows Server 2012 R2 (KB3144850)
12> Security Update for Windows Server 2012 R2 (KB3156016)
13> Security Update for Windows Server 2012 R2 (KB3156059)
14> Security Update for Windows Server 2012 R2 (KB3155784)
15> Security Update for Windows Server 2012 R2 (KB3156019)
16> Security Update for Windows Server 2012 R2 (KB3153704)
17> Security Update for Windows Server 2012 R2 (KB3156017)
18> Security Update for Microsoft .NET Framework 4.6 and 4.6.1 for Windows 8.1 and Server 2012 R2 for x64 (KB3135998)
19> Security Update for Windows Server 2012 R2 (KB3151058)
20> Security Update for Microsoft .NET Framework 4.6 and 4.6.1 for Windows 8.1 and Server 2012 R2 for x64 (KB3142036)
21> Update for Windows Server 2012 R2 (KB3162835)
22> Security Update for Windows Server 2012 R2 (KB3161561)
23> Security Update for Windows Server 2012 R2 (KB3159398)
24> Security Update for Windows Server 2012 R2 (KB3164035)
25> Security Update for Windows Server 2012 R2 (KB3161949)
26> Security Update for Windows Server 2012 R2 (KB3161958)
27> Security Update for Windows Server 2012 R2 (KB3164033)
28> Security Update for Windows Server 2012 R2 (KB3164294)
29> Security Update for Windows Server 2012 R2 (KB3162343)
30> Security Update for Windows Server 2012 R2 (KB3170455)
31> Security Update for Microsoft .NET Framework 4.6 and 4.6.1 for Windows 8.1 and Server 2012 R2 for x64 (KB3164024)
32> Security Update for Windows Server 2012 R2 (KB3170377)
33> Security Update for Windows Server 2012 R2 (KB3169704)
34> Security Update for Windows Server 2012 R2 (KB3172727)
35> Update for Windows Server 2012 R2 (KB3173424)
36> Windows Malicious Software Removal Tool for Windows 8, 8.1, 10 and Windows Server 2012, 2012 R2 x64 Edition - August
 2016 (KB890830)
37> Security Update for Windows Server 2012 R2 (KB3167679)
38> Security Update for Windows Server 2012 R2 (KB3172729)
39> Security Update for Windows Server 2012 R2 (KB3177108)
40> Security Update for Windows Server 2012 R2 (KB3177725)
41> Security Update for Windows Server 2012 R2 (KB3175887)
42> Security Update for Windows Server 2012 R2 (KB3178034)
43> Update for Windows Server 2012 R2 (KB3172614)
44> Cumulative Security Update for Internet Explorer 11 for Windows Server 2012 R2 (KB3175443)
45> Update for Windows Server 2012 R2 (KB3177723)
46> Update for Windows Server 2012 R2 (KB3179574)
 
Select an option:
(A)ll updates, (N)o updates or (S)elect a single update? A

You can specify which update(s) you want to install and it will continue.

Installing updates...
 
Listing of updates installed and individual installation results:
 
1> Update for Windows Server 2012 R2 (KB3146604): Succeeded
2> Update for Windows Server 2012 R2 (KB3146978): Succeeded
3> Update for Windows Server 2012 R2 (KB3103616): Succeeded
4> Update for Windows Server 2012 R2 (KB3146751): Succeeded
5> Update for Windows Server 2012 R2 (KB3145384): Succeeded
6> Update for Windows Server 2012 R2 (KB3149157): Succeeded
7> Update for Windows Server 2012 R2 (KB3125424): Succeeded
8> Update for Windows Server 2012 R2 (KB3145432): Succeeded
9> Update for Windows Server 2012 R2 (KB3103709): Succeeded
10> Update for Windows Server 2012 R2 (KB3134179): Succeeded
11> Update for Windows Server 2012 R2 (KB3144850): Succeeded
12> Security Update for Windows Server 2012 R2 (KB3156016): Succeeded
13> Security Update for Windows Server 2012 R2 (KB3156059): Succeeded
14> Security Update for Windows Server 2012 R2 (KB3155784): Succeeded
15> Security Update for Windows Server 2012 R2 (KB3156019): Succeeded
16> Security Update for Windows Server 2012 R2 (KB3153704): Succeeded
17> Security Update for Windows Server 2012 R2 (KB3156017): Succeeded
18> Security Update for Microsoft .NET Framework 4.6 and 4.6.1 for Windows 8.1 and Server 2012 R2 for x64 (KB3135998): S
ucceeded
19> Security Update for Windows Server 2012 R2 (KB3151058): Succeeded
20> Security Update for Microsoft .NET Framework 4.6 and 4.6.1 for Windows 8.1 and Server 2012 R2 for x64 (KB3142036): S
ucceeded
21> Update for Windows Server 2012 R2 (KB3162835): Succeeded
22> Security Update for Windows Server 2012 R2 (KB3161561): Succeeded
23> Security Update for Windows Server 2012 R2 (KB3159398): Succeeded
24> Security Update for Windows Server 2012 R2 (KB3164035): Succeeded
25> Security Update for Windows Server 2012 R2 (KB3161949): Succeeded
26> Security Update for Windows Server 2012 R2 (KB3161958): Succeeded
27> Security Update for Windows Server 2012 R2 (KB3164033): Succeeded
28> Security Update for Windows Server 2012 R2 (KB3164294): Succeeded
29> Security Update for Windows Server 2012 R2 (KB3162343): Succeeded
30> Security Update for Windows Server 2012 R2 (KB3170455): Succeeded
31> Security Update for Microsoft .NET Framework 4.6 and 4.6.1 for Windows 8.1 and Server 2012 R2 for x64 (KB3164024): S
ucceeded
32> Security Update for Windows Server 2012 R2 (KB3170377): Succeeded
33> Security Update for Windows Server 2012 R2 (KB3169704): Succeeded
34> Security Update for Windows Server 2012 R2 (KB3172727): Succeeded
35> Update for Windows Server 2012 R2 (KB3173424): Succeeded
36> Windows Malicious Software Removal Tool for Windows 8, 8.1, 10 and Windows Server 2012, 2012 R2 x64 Edition - August
 2016 (KB890830): Succeeded
37> Security Update for Windows Server 2012 R2 (KB3167679): Succeeded
38> Security Update for Windows Server 2012 R2 (KB3172729): Succeeded
39> Security Update for Windows Server 2012 R2 (KB3177108): Succeeded
40> Security Update for Windows Server 2012 R2 (KB3177725): Succeeded
41> Security Update for Windows Server 2012 R2 (KB3175887): Succeeded
42> Security Update for Windows Server 2012 R2 (KB3178034): Succeeded
43> Update for Windows Server 2012 R2 (KB3172614): Succeeded
44> Cumulative Security Update for Internet Explorer 11 for Windows Server 2012 R2 (KB3175443): Succeeded
45> Update for Windows Server 2012 R2 (KB3177723): Succeeded
46> Update for Windows Server 2012 R2 (KB3179574): Succeeded
 
Installation Result: Succeeded
Restart Required: True
 
Press return to continue...