Microsoft Updates Extractor PowerShell Script

I wrote this script in order to extract MSP files from CAB files. The purpose of this in my case was to get Office updates that already existed in SCCM and to put their MSP files into the Office installation folder’s “updates” directory in order to have the updates automatically installed when Office is installed.

There are a few scripts online that do this already, but they are much more complicated since they dig in to the SCCM database and download the CAB files from the management point themselves, among other unnecessary (in my case) tasks. I wanted a simpler script that I could run on my own machine rather than the SCCM server for security reasons, so I came up with this PowerShell script that does just that, including renaming the files to match their KB numbers.

The script requires an “msp” folder and an “updates” folder to reside in the same directory as the script. Since this script is run locally, you need to have the CAB files already on your computer. The CAB files from SCCM do not need to be moved out of their respective folders – you can simply copy them as-is from your SCCM updates folder. This means your “updates” folder in the script directory can have folders inside of it, and those folders will have the CAB files. Once complete, the extracted MSP files will all be together in the “msp” folder, ready to copy to your Office installation’s “updates” directory.

Here is the script:

6 thoughts on “Microsoft Updates Extractor PowerShell Script

  1. ws2000

    Hello

    I had downloaded all my Office 2016 x64 updates from my SCCM. I ran your script and it appeared to work perfectly but when I look in the msp folder 66 out of a 108 files starts with KB4011098 for a file name. Any idea why?

    Thanks

    Reply
    1. Boris Kagan Post author

      Hi,

      This is because a KB can have multiple files associated with it, such as one for x86 and one for x64. In this case, I’m guessing you’re seeing 66 of KB3141450, which is the Microsoft Office 2016 Language Interface Pack? I believe this specific update has a separate installer for every different language when it’s downloaded through SCCM. If you have SCCM set to synchronize all languages during update sync, you will have 66 files as expected. You can verify this by searching for this update in the SCCM console under “All Software Updates” under the Software Library – you should see 66 results there as well.

      Let me know if you have any more questions.

      Reply
  2. wsus

    I dont have cab. files in folders. I download it from wsus to one folder.. I would like use simply expand but must check the oldest one first.

    Reply
  3. Jason

    I ran this script, but it doesn’t seem to do anything. I have all the updates in individual folders and an empty MSP folder in the same directory. The scripts says that Update folders found press enter to start extraction. Then after pressing enter, it says update folders found. Items expanded. Script complete. press enter to exit. But when I check the MSP folder there is nothing there. Any suggestions?

    Reply
  4. Steve

    This script is a life saver. I’ve tried three other scripts today that were supposed to do what this one does, but they all gave me some form of error or another. This one just worked.

    I created a folder called EXTRACT, and inside that folder I created subfolders called MSP and UPDATES. The UPDATES folder contains all of the .cab folders that I swiped from my SCCM server. Save the script in the EXTRACT folder and run from there.

    Kudos to Boris. Thank you sir, for sharing your script.

    Reply

Leave a Reply to alan Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.