Sometimes you need to install a list of hotfixes for the Windows Server or client operating system, provided as *.MSU files by Microsoft.

The issue is that KB articles that are already installed will cause the process to fail.

In this blog post, I provide a Powershell script to install a list of MSU files that you may have manually downloaded.

What are MSU files?

A *.msu file or a Microsoft Update file is packaged used by Microsoft Update. This file is installed using the stand-alone installer wusa.exe. The stand-alone installer is run automatically when installing an update through Microsoft Update, but it can also be triggered manually.

The MSU files, similar to MSI files, are archived files, which contain a CAB file.

How do I extract a CAB file from an MSU?

You can extract the CAB file from an MSU file using this command line:

expand -f "<name of MSU file>" "<destination>"

An example would be:

expand -f "" "C:\temp\MSU"

How do I install a CAB file?

If you want to install a CAB file which you have extracted, you can use this dism command to install:

dism.exe /online /add-package /packagepath:"<cab file" /quiet /norestart /logpath:"<path to log>"

What is wusa.exe?

Wusa.exe can be found in the %WinDir%\System32 folder and contains the following data:

Windows Update metadataDescribes each update package that the .msu file contains.

One or more .cab filesEach .cab file represents one update.

An .xml fileThis .xml file describes the .msu update package. Wusa.exe uses the .xml file when you perform an unattended installation of the update using the Package Manager tool (Pkgmgr.exe).

For example, you download hotfix 934307. The Windows6.0-KB934307-x86.msu file is in the C:\934307 folder. You type the following command at a command prompt to expand the .msu file to a temporary folder:

expand -f:* “C:\934307\Windows6.0-KB934307-x86.msu” %TEMP%
Then, you type the following command at a command prompt:

pkgmgr.exe /n:%TEMP%\Windows6.0-KB934307-x86.xml
A properties fileThis file contains string properties that Wusa.exe uses. For example, this file includes the title of the associated article in the Microsoft Knowledge Base.


Install MSU files using a Powershell script

The Powershell script below takes the KB articles on the list and only install those KB numbers not already installed.

Just change the Powershell script according to your requirements.

#Source folder
$SourceFolder = "c:\temp\"
#Crete new Powershell object
$KBArrayList = New-Object -TypeName System.Collections.ArrayList 
#Mofify KB article list
foreach ($KB in $KBArrayList) { 
    if (-not(Get-Hotfix -Id $KB)) { 
        Start-Process -FilePath "wusa.exe" -ArgumentList "$SourceFolder$KB.msu /quiet /norestart" -Wait } 

Related Posts


  1. Oldie, but goodie. 🙂 thanks for this, but shoulndn’t your “$SourceFolder” have a “backslash” at the end; else the “path” would be messed up?

    You have this:
    #Source folder
    $SourceFolder = “c:\temp”

    Should be:
    $SourceFolder = “c:\temp\”

    Notice “\” ater “temp” above, else: “$SourceFolder” would not have “\” before the “$KB”

    -ArgumentList “$SourceFolder$KB.msu

    I think yours would yield:

    But it should be:

    Or leave it the way you have it, but put “\” between the 2, like this:


  2. Hey very new to trying to Powershell.
    I tried to use this script with the understanding that this would grab the kb and install it on the machine. I think I am missing a piece.

    How could I leverage this to download and install the kb’s from the array?

    • Hey Justin were you able to push the KB’s if so please suggest me the solution as well I would really appreciate the same


Please enter your comment!
Please enter your name here