How to download and install offline Windows updates with PowerShell
Automating Windows Update Services can be a pain! It’s often easier to install an offline Windows update with PowerShell, but where can you download offline update files? Thankfully, the Microsoft Update Catalog site provides offline .msu
files for all updates that are released. And, using the MSCatalog module, it’s a breeze to download and install these offline updates using PowerShell.
In this tutorial, you’ll first learn how to install the MSCatalog PowerShell module and query the Microsoft Update Catalog site. Then, you’ll see how to download one or more updates and install them using PowerShell.
Prerequisites
To follow along with this tutorial, you’ll just need to have PowerShell 5.1 or later installed. This tutorial will use PowerShell 7.1 running on a Windows Server 2019 server, although all of the processes will also work on a Windows 10 workstation.
Installing the MSCatalog PowerShell module
If you haven’t done so already, the first thing you’ll need to do is install the latest version of the MSCatalog module from the PowerShell Gallery. This is as simple as running the following command.
Install-Module -Name "MSCatalog"
If you already have the module installed, it’s good practice to make sure it is the latest version. You can do this using the Update-Module cmdlet; for example:
Update-Module -Name "MSCatalog"
Searching for updates using Get-MSCatalogUpdate
Now that you’ve got the latest version of MSCatalog installed, you can start querying the Microsoft Update Catalog site. To do this, you’ll use the Get-MSCatalogUpdate
command.
Searching by the KB article number
If you already know the KB article number relating to the update you’re searching for, you can simply specify this using the search
parameter. For example, the following command will search for updates matching KB5003646
.
Get-MSCatalogUpdate -Search "KB5003646"
PS C:\> Get-MSCatalogUpdate -Search "KB5003646"
Title Products Classification LastUpdated Size
----- -------- -------------- ----------- ----
2021-06 Cumulative Update for Windows 10 Version 1809 for ARM64-based Systems (KB5003646) Windows 10,Windows 10 LTSB Security Updates 2021/06/07 549.6 MB
2021-06 Cumulative Update for Windows Server 2019 for x64-based Systems (KB5003646) Windows Server 2019 Security Updates 2021/06/07 499.5 MB
2021-06 Cumulative Update for Windows 10 Version 1809 for x64-based Systems (KB5003646) Windows 10,Windows 10 LTSB Security Updates 2021/06/07 499.5 MB
2021-06 Cumulative Update for Windows 10 Version 1809 for x86-based Systems (KB5003646) Windows 10,Windows 10 LTSB Security Updates 2021/06/07 278.8 MB
This is by far the fastest and most accurate way to search the Microsoft Update Catalog site. But what if you don’t know the KB number?
Searching using keywords
If you don’t know the KB article number, you can filter the updates by providing one or more keywords to the search
parameter. The example below provides a string (Cumulative Update for Windows Server 2019 for x64-based Systems
) to the search
parameter to filter the results. However, by default, the Microsoft Catalog Update site treats each of the words in this string as individual search terms, and tries to match them using an OR
operator (e.g., Title contains “Cumulative” OR “Update” OR “for” etc.). This often provides results that aren’t very accurate.
Get-MSCatalogUpdate -Search "Cumulative Update for Windows Server 2019 for x64-based Systems"
PS C:\> Get-MSCatalogUpdate -Search "Cumulative Update for Windows Server 2019 for x64-based Systems"
Title Products Classification LastUpdated Size
----- -------- -------------- ----------- ----
2021-06 Cumulative Update Preview for Azure Stack HCI, version 20H2 and Windows Server 2019 Datacenter: Azure Edition for x64-based Systems (KB5003704) Azure Stack HCI Updates 2021/06/15 153.9 MB
2021-06 Cumulative Update Preview for Windows Server 2019 for x64-based Systems (KB5003703) Windows Server 2019 Updates 2021/06/15 500.0 MB
2021-06 Cumulative Update for Windows Server 2019 Datacenter: Azure Edition for x64-based Systems (KB5003643) Windows Server 2019 Datacenter: Azure Edition Hotpatch Security Updates 2021/06/07 150.7 MB
2021-06 Cumulative Update for Windows Server 2019 for x64-based Systems (KB5003646) Windows Server 2019 Security Updates 2021/06/07 499.5 MB
2021-06 Cumulative Update for Azure Stack HCI, version 20H2 and Windows Server 2019 Datacenter: Azure Edition for x64-based Systems (KB5003643) Azure Stack HCI Security Updates 2021/06/07 150.7 MB
2021-05 Cumulative Update Preview for Windows Server 2019 for x64-based Systems (KB5003217) Windows Server 2019 Updates 2021/05/20 494.0 MB
2021-05 Cumulative Update Preview for Azure Stack HCI, version 20H2 and Windows Server 2019 Datacenter: Azure Edition for x64-based Systems (KB5003237) Azure Stack HCI Updates 2021/05/20 148.0 MB
2021-05 Cumulative Update for Windows Server 2019 for x64-based Systems (KB5003171) Windows Server 2019 Security Updates 2021/05/12 487.9 MB
2021-05 Cumulative Update for Windows Server 2019 Datacenter: Azure Edition for x64-based Systems (KB5003188) Windows Server 2019 Datacenter: Azure Edition Hotpatch Security Updates 2021/05/10 148.0 MB
2021-05 Cumulative Update for Azure Stack HCI, version 20H2 and Windows Server 2019 Datacenter: Azure Edition for x64-based Systems (KB5003188) Azure Stack HCI Security Updates 2021/05/10 148.0 MB
2021-04 Cumulative Update Preview for Windows Server 2019 for x64-based Systems (KB5001384) Windows Server 2019 Updates 2021/04/22 488.8 MB
2021-04 Cumulative Update Preview for Azure Stack HCI, version 20H2 and Windows Server 2019 Datacenter: Azure Edition for x64-based Systems (KB5001395) Azure Stack HCI Updates 2021/04/22 144.3 MB
2021-04 Cumulative Update for Windows Server 2019 Datacenter: Azure Edition for x64-based Systems (KB5001343) Windows Server 2019 Datacenter: Azure Edition Hotpatch Security Updates 2021/04/12 142.3 MB
2021-04 Cumulative Update for Azure Stack HCI, version 20H2 and Windows Server 2019 Datacenter: Azure Edition for x64-based Systems (KB5001343) Azure Stack HCI Security Updates 2021/04/12 142.3 MB
2021-04 Cumulative Update for Windows Server 2019 for x64-based Systems (KB5001342) Windows Server 2019 Security Updates 2021/04/12 393.6 MB
2021-03 Cumulative Update Preview for Azure Stack HCI, version 20H2 and Windows Server 2019 Datacenter: Azure Edition for x64-based Systems (KB5000849) Azure Stack HCI Updates 2021/03/25 139.8 MB
2021-03 Cumulative Update Preview for Windows Server 2019 for x64-based Systems (KB5000854) Windows Server 2019 Updates 2021/03/25 392.3 MB
2021-03 Cumulative Update for Windows Server 2019 for x64-based Systems (KB5001638) Windows Server 2019 Updates 2021/03/18 391.4 MB
2021-03 Cumulative Update for Windows Server 2019 for x64-based Systems (KB5001568) Windows Server 2019 Updates 2021/03/15 391.5 MB
2021-03 Cumulative Update for Windows Server 2019 Datacenter: Azure Edition for x64-based Systems (KB5000801) Windows Server 2019 Datacenter: Azure Edition Hotpatch Security Updates 2021/03/08 137.9 MB
2021-03 Cumulative Update for Azure Stack HCI, version 20H2 and Windows Server 2019 Datacenter: Azure Edition for x64-based Systems (KB5000801) Azure Stack HCI Security Updates 2021/03/08 137.9 MB
2021-03 Cumulative Update for Windows Server 2019 for x64-based Systems (KB5000822) Windows Server 2019 Security Updates 2021/03/08 391.2 MB
2021-02 Cumulative Update Preview for Windows Server 2019 for x64-based Systems (KB4601383) Windows Server 2019 Updates 2021/02/16 383.1 MB
2021-02 Cumulative Update for Windows Server 2019 for x64-based Systems (KB4601345) Windows Server 2019 Security Updates 2021/02/08 381.2 MB
2021-01 Cumulative Update Preview for Windows Server 2019 for x64-based Systems (KB4598296) Windows Server 2019 Updates 2021/01/21 380.8 MB
To ensure that only results containing the entire search term are returned, you can use the strict
switch parameter. For example, the following command will search for updates containing the exact phrase Cumulative Update for Windows Server 2019 for x64-based Systems
.
The search term is matched across all available fields, not just the Title.
Get-MSCatalogUpdate -Search "Cumulative Update for Windows Server 2019 for x64-based Systems" -Strict
PS C:\> Get-MSCatalogUpdate -Search "Cumulative Update for Windows Server 2019 for x64-based Systems" -Strict
Title Products Classification LastUpdated Size
----- -------- -------------- ----------- ----
2021-06 Cumulative Update for Windows Server 2019 for x64-based Systems (KB5003646) Windows Server 2019 Security Updates 2021/06/07 499.5 MB
2021-05 Cumulative Update for Windows Server 2019 for x64-based Systems (KB5003171) Windows Server 2019 Security Updates 2021/05/12 487.9 MB
2021-04 Cumulative Update for Windows Server 2019 for x64-based Systems (KB5001342) Windows Server 2019 Security Updates 2021/04/12 393.6 MB
2021-03 Cumulative Update for Windows Server 2019 for x64-based Systems (KB5001638) Windows Server 2019 Updates 2021/03/18 391.4 MB
2021-03 Cumulative Update for Windows Server 2019 for x64-based Systems (KB5001568) Windows Server 2019 Updates 2021/03/15 391.5 MB
2021-03 Cumulative Update for Windows Server 2019 for x64-based Systems (KB5000822) Windows Server 2019 Security Updates 2021/03/08 391.2 MB
2021-02 Cumulative Update for Windows Server 2019 for x64-based Systems (KB4601345) Windows Server 2019 Security Updates 2021/02/08 381.2 MB
2021-01 Cumulative Update for Windows Server 2019 for x64-based Systems (KB4598230) Windows Server 2019 Security Updates 2021/01/11 378.1 MB
2020-12 Cumulative Update for Windows Server 2019 for x64-based Systems (KB4592440) Windows Server 2019 Security Updates 2020/12/06 349.1 MB
2020-11 Cumulative Update for Windows Server 2019 for x64-based Systems (KB4594442) Windows Server 2019 Updates 2020/11/17 346.3 MB
2020-11 Cumulative Update for Windows Server 2019 for x64-based Systems (KB4586793) Windows Server 2019 Security Updates 2020/11/06 346.6 MB
2020-10 Cumulative Update for Windows Server 2019 for x64-based Systems (KB4577668) Windows Server 2019 Security Updates 2020/10/12 368.3 MB
2020-06 Cumulative Update for Windows Server 2019 for x64-based Systems (KB4567513) Windows Server 2019 Updates 2020/06/15 332.6 MB
2020-04 Cumulative Update for Windows Server 2019 for x64-based Systems (KB4550969) Windows Server 2019 Updates 2020/04/20 319.4 MB
2020-03 Cumulative Update for Windows Server 2019 for x64-based Systems (KB4554354) Windows Server 2019 Updates 2020/03/30 317.5 MB
2020-03 Cumulative Update for Windows Server 2019 for x64-based Systems (KB4541331) Windows Server 2019 Updates 2020/03/16 317.5 MB
2020-02 Cumulative Update for Windows Server 2019 for x64-based Systems (KB4537818) Windows Server 2019 Updates 2020/02/24 312.2 MB
2020-01 Cumulative Update for Windows Server 2019 for x64-based Systems (KB4534321) Windows Server 2019 Updates 2020/01/22 285.1 MB
2019-10 Cumulative Update for Windows Server 2019 for x64-based Systems (KB4520062) Windows Server 2019 Updates 2019/10/14 279.0 MB
2019-08 Cumulative Update for Windows Server 2019 for x64-based Systems (KB4512534) Windows Server 2019 Updates 2019/08/17 271.1 MB
2019-07 Cumulative Update for Windows Server 2019 for x64-based Systems (KB4505658) Windows Server 2019 Updates 2019/07/22 261.3 MB
2019-06 Cumulative Update for Windows Server 2019 for x64-based Systems (KB4509479) Windows Server 2019 Updates 2019/06/26 248.0 MB
2019-06 Cumulative Update for Windows Server 2019 for x64-based Systems (KB4501371) Windows Server 2019 Updates 2019/06/18 245.2 MB
2019-05 Cumulative Update for Windows Server 2019 for x64-based Systems (KB4497934) Windows Server 2019 Updates 2019/05/20 237.3 MB
2019-05 Cumulative Update for Windows Server 2019 for x64-based Systems (KB4505056) Windows Server 2019 Updates 2019/05/19 223.3 MB
When searching using keywords, you’ll get the best results by being as specific as possible.
Manipulating the search results
By default, the results are sorted by the LastUpdated
field in descending order (i.e., the newest update should be first in the list). However, you can use the SortBy
and Descending
parameters to manipulate the search results, as required.
For example, the following command will perform the previous search again, but this time the SortBy
parameter is set to Size
. This will cause the results to be sorted by the Size column in ascending order. If you wanted the results in descending order, you’d simply add the Descending
switch parameter.
This example uses PowerShell splatting, which you can learn more about here!
$Params = @{
Search = "Cumulative Update for Windows Server 2019 for x64-based Systems"
Strict = $true
SortBy = "Size"
}
Get-MSCatalogUpdate @Params
PS C:\> Get-MSCatalogUpdate @Params
Title Products Classification LastUpdated Size
----- -------- -------------- ----------- ----
2018-10 Cumulative Update for Windows Server 2019 for x64-based Systems (KB4464455) Windows Server 2019 Updates 2018/11/09 85.0 MB
2018-11 Cumulative Update for Windows Server 2019 for x64-based Systems (KB4469342) Windows Server 2019 Updates 2018/12/04 116.1 MB
2019-01 Cumulative Update for Windows Server 2019 for x64-based Systems (KB4476976) Windows Server 2019 Updates 2019/01/18 137.7 MB
2019-02 Cumulative Update for Windows Server 2019 for x64-based Systems (KB4482887) Windows Server 2019 Updates 2019/02/28 152.7 MB
2019-03 Cumulative Update for Windows Server 2019 for x64-based Systems (KB4490481) Windows Server 2019 Updates 2019/04/01 164.4 MB
2019-05 Cumulative Update for Windows Server 2019 for x64-based Systems (KB4501835) Windows Server 2019 Updates 2019/05/01 219.9 MB
2019-04 Cumulative Update for Windows Server 2019 for x64-based Systems (KB4495667) Windows Server 2019 Updates 2019/05/03 222.0 MB
2019-05 Cumulative Update for Windows Server 2019 for x64-based Systems (KB4505056) Windows Server 2019 Updates 2019/05/19 223.3 MB
2019-05 Cumulative Update for Windows Server 2019 for x64-based Systems (KB4497934) Windows Server 2019 Updates 2019/05/20 237.3 MB
2019-06 Cumulative Update for Windows Server 2019 for x64-based Systems (KB4501371) Windows Server 2019 Updates 2019/06/18 245.2 MB
2019-06 Cumulative Update for Windows Server 2019 for x64-based Systems (KB4509479) Windows Server 2019 Updates 2019/06/26 248.0 MB
2019-07 Cumulative Update for Windows Server 2019 for x64-based Systems (KB4505658) Windows Server 2019 Updates 2019/07/22 261.3 MB
2019-08 Cumulative Update for Windows Server 2019 for x64-based Systems (KB4512534) Windows Server 2019 Updates 2019/08/17 271.1 MB
2019-10 Cumulative Update for Windows Server 2019 for x64-based Systems (KB4520062) Windows Server 2019 Updates 2019/10/14 279.0 MB
2020-01 Cumulative Update for Windows Server 2019 for x64-based Systems (KB4534321) Windows Server 2019 Updates 2020/01/22 285.1 MB
2020-02 Cumulative Update for Windows Server 2019 for x64-based Systems (KB4537818) Windows Server 2019 Updates 2020/02/24 312.2 MB
2020-03 Cumulative Update for Windows Server 2019 for x64-based Systems (KB4554354) Windows Server 2019 Updates 2020/03/30 317.5 MB
2020-03 Cumulative Update for Windows Server 2019 for x64-based Systems (KB4541331) Windows Server 2019 Updates 2020/03/16 317.5 MB
2020-04 Cumulative Update for Windows Server 2019 for x64-based Systems (KB4550969) Windows Server 2019 Updates 2020/04/20 319.4 MB
2020-06 Cumulative Update for Windows Server 2019 for x64-based Systems (KB4567513) Windows Server 2019 Updates 2020/06/15 332.6 MB
2020-11 Cumulative Update for Windows Server 2019 for x64-based Systems (KB4594442) Windows Server 2019 Updates 2020/11/17 346.3 MB
2020-11 Cumulative Update for Windows Server 2019 for x64-based Systems (KB4586793) Windows Server 2019 Security Updates 2020/11/06 346.6 MB
2020-12 Cumulative Update for Windows Server 2019 for x64-based Systems (KB4592440) Windows Server 2019 Security Updates 2020/12/06 349.1 MB
2020-10 Cumulative Update for Windows Server 2019 for x64-based Systems (KB4577668) Windows Server 2019 Security Updates 2020/10/12 368.3 MB
2021-01 Cumulative Update for Windows Server 2019 for x64-based Systems (KB4598230) Windows Server 2019 Security Updates 2021/01/11 378.1 MB
The SortBy
parameter accepts any of the following column headers; Title, Products, Classification, LastUpdated, and Size.
Returning more than 25 results at a time
So far, all of the previous examples have returned a maximum of 25 results. This is because the Microsoft Update Catalog site only provides 25 results at a time . If you want to return all available results, you can specify the AllPages
switch parameter. This will make multiple web requests to the Microsoft Update Catalog site to retrieve all available pages of results; for example:
$Params = @{
Search = "Cumulative Update for Windows Server 2019 for x64-based Systems"
Strict = $true
SortBy = "Size"
AllPages = $true
}
Get-MSCatalogUpdate @Params
PS C:\> Get-MSCatalogUpdate @Params
Title Products Classification LastUpdated Size
----- -------- -------------- ----------- ----
2018-10 Cumulative Update for Windows Server 2019 for x64-based Systems (KB4464455) Windows Server 2019 Updates 2018/11/09 85.0 MB
2018-11 Cumulative Update for Windows Server 2019 for x64-based Systems (KB4469342) Windows Server 2019 Updates 2018/12/04 116.1 MB
2019-01 Cumulative Update for Windows Server 2019 for x64-based Systems (KB4476976) Windows Server 2019 Updates 2019/01/18 137.7 MB
2019-02 Cumulative Update for Windows Server 2019 for x64-based Systems (KB4482887) Windows Server 2019 Updates 2019/02/28 152.7 MB
2019-03 Cumulative Update for Windows Server 2019 for x64-based Systems (KB4490481) Windows Server 2019 Updates 2019/04/01 164.4 MB
2019-05 Cumulative Update for Windows Server 2019 for x64-based Systems (KB4501835) Windows Server 2019 Updates 2019/05/01 219.9 MB
2019-04 Cumulative Update for Windows Server 2019 for x64-based Systems (KB4495667) Windows Server 2019 Updates 2019/05/03 222.0 MB
2019-05 Cumulative Update for Windows Server 2019 for x64-based Systems (KB4505056) Windows Server 2019 Updates 2019/05/19 223.3 MB
2019-05 Cumulative Update for Windows Server 2019 for x64-based Systems (KB4497934) Windows Server 2019 Updates 2019/05/20 237.3 MB
2019-06 Cumulative Update for Windows Server 2019 for x64-based Systems (KB4501371) Windows Server 2019 Updates 2019/06/18 245.2 MB
2019-06 Cumulative Update for Windows Server 2019 for x64-based Systems (KB4509479) Windows Server 2019 Updates 2019/06/26 248.0 MB
2019-07 Cumulative Update for Windows Server 2019 for x64-based Systems (KB4505658) Windows Server 2019 Updates 2019/07/22 261.3 MB
2019-08 Cumulative Update for Windows Server 2019 for x64-based Systems (KB4512534) Windows Server 2019 Updates 2019/08/17 271.1 MB
2019-10 Cumulative Update for Windows Server 2019 for x64-based Systems (KB4520062) Windows Server 2019 Updates 2019/10/14 279.0 MB
2020-01 Cumulative Update for Windows Server 2019 for x64-based Systems (KB4534321) Windows Server 2019 Updates 2020/01/22 285.1 MB
2020-02 Cumulative Update for Windows Server 2019 for x64-based Systems (KB4537818) Windows Server 2019 Updates 2020/02/24 312.2 MB
2020-03 Cumulative Update for Windows Server 2019 for x64-based Systems (KB4554354) Windows Server 2019 Updates 2020/03/30 317.5 MB
2020-03 Cumulative Update for Windows Server 2019 for x64-based Systems (KB4541331) Windows Server 2019 Updates 2020/03/16 317.5 MB
2020-04 Cumulative Update for Windows Server 2019 for x64-based Systems (KB4550969) Windows Server 2019 Updates 2020/04/20 319.4 MB
2020-06 Cumulative Update for Windows Server 2019 for x64-based Systems (KB4567513) Windows Server 2019 Updates 2020/06/15 332.6 MB
2020-11 Cumulative Update for Windows Server 2019 for x64-based Systems (KB4594442) Windows Server 2019 Updates 2020/11/17 346.3 MB
2020-11 Cumulative Update for Windows Server 2019 for x64-based Systems (KB4586793) Windows Server 2019 Security Updates 2020/11/06 346.6 MB
2020-12 Cumulative Update for Windows Server 2019 for x64-based Systems (KB4592440) Windows Server 2019 Security Updates 2020/12/06 349.1 MB
2020-10 Cumulative Update for Windows Server 2019 for x64-based Systems (KB4577668) Windows Server 2019 Security Updates 2020/10/12 368.3 MB
2021-01 Cumulative Update for Windows Server 2019 for x64-based Systems (KB4598230) Windows Server 2019 Security Updates 2021/01/11 378.1 MB
2021-02 Cumulative Update for Windows Server 2019 for x64-based Systems (KB4601345) Windows Server 2019 Security Updates 2021/02/08 381.2 MB
2021-03 Cumulative Update for Windows Server 2019 for x64-based Systems (KB5000822) Windows Server 2019 Security Updates 2021/03/08 391.2 MB
2021-03 Cumulative Update for Windows Server 2019 for x64-based Systems (KB5001638) Windows Server 2019 Updates 2021/03/18 391.4 MB
2021-03 Cumulative Update for Windows Server 2019 for x64-based Systems (KB5001568) Windows Server 2019 Updates 2021/03/15 391.5 MB
2021-04 Cumulative Update for Windows Server 2019 for x64-based Systems (KB5001342) Windows Server 2019 Security Updates 2021/04/12 393.6 MB
2021-05 Cumulative Update for Windows Server 2019 for x64-based Systems (KB5003171) Windows Server 2019 Security Updates 2021/05/12 487.9 MB
2021-06 Cumulative Update for Windows Server 2019 for x64-based Systems (KB5003646) Windows Server 2019 Security Updates 2021/06/07 499.5 MB
Even with the AllPages
parameter, the Microsoft Catalog Update site will only provide a maximum of 1000 updates per search. This is another reason to make your search terms as specific as possible.
Downloading updates using Save-MSCatalogUpdate
Now that you’ve mastered searching for updates using Get-MSCatalogUpdate
, you’ll need to know how to download them. For this, you’ll use the Save-MSCatalogUpdate
command.
The first step is to use Get-MSCatalogUpdate
to store a single update in a variable. For example, the following command will store the Cumulative Update for Windows Server 2019 for x64-based Systems (KB5003646)
update in the $Update
variable.
$Update = Get-MSCatalogUpdate -Search "Cumulative Update for Windows Server 2019 for x64-based Systems (KB5003646)"
# Store the update in the $Update variable.
PS C:\> $Update = Get-MSCatalogUpdate -Search "Cumulative Update for Windows Server 2019 for x64-based Systems (KB5003646)"
# Print the $Update variable to the console to check that it contains a single update.
PS C:\> $Update
Title Products Classification LastUpdated Size
----- -------- -------------- ----------- ----
2021-06 Cumulative Update for Windows Server 2019 for x64-based Systems (KB5003646) Windows Server 2019 Security Updates 2021/06/07 499.5 MB
Then, you can pass the $Update
variable to the Update
parameter of Save-MSCatalogUpdate
to download it. You’ll also need to provide a path to the Destination
parameter; for example:
Save-MSCatalogUpdate -Update $Update -Destination "C:\Temp"
# Save the update in $Update to C:\Temp.
PS C:\> Save-MSCatalogUpdate -Update $Update -Destination "C:\Temp"
# The Save-MSCatalogUpdate command doesn't show any output if successful. Instead,
# you can use Get-ChildItem to see the downloaded file.
PS C:\> Get-ChildItem -Path "C:\Temp"
Directory: C:\Temp
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a--- 18/06/2021 14:13 523802045 windows10.0-kb5003646-x64_ef50cfb8e8067dd27c13ae7c4150d20cb346b3bf.msu
If your $Update
variable contains more than one update, you can always specify which update to download by its index in the array (e.g., $Update[2]
will download the third update in a zero-based array).
Sending the update object down the pipeline
The Save-MSCatalogUpdate
command can receive the update object to download via the pipeline. This can be useful for writing simple one-liners to quickly download a particular update. For example, to download the latest version of the Cumulative Update for Windows Server 2019 for x64-based Systems
you can do the following.
# Reference the first update returned by its index in the array (0), and pipe it to the Save-MSCatalogUpdate command.
(Get-MSCatalogUpdate -Search "Cumulative Update for Windows Server 2019 for x64-based Systems")[0] | Save-MSCatalogUpdate -Destination "C:\Temp"
Dealing with updates composed of multiple files
Some updates are composed of multiple files. This often happens when there is more than one language available for a particular update. When this is the case, Save-MSCatalogUpdate
will detect the available options and prompt you to select which ones to download.
For example, the following commands attempt to download the Update for Microsoft Office 2013 (KB4011677) 32-Bit Edition
update, which contains multiple files. Save-MSCatalogUpdate
will prompt you to select the required file by specifying its Id
, or you can enter A
to download all of the files. In this example, enter 11
to download the en-us
language file.
$Update = Get-MSCatalogUpdate -Search "Update for Microsoft Office 2013 (KB4011677) 32-Bit Edition"
Save-MSCatalogUpdate -Update $Update -Destination ".\"
PS C:\> $Update = Get-MSCatalogUpdate -Search "Update for Microsoft Office 2013 (KB4011677) 32-Bit Edition"
PS C:\> Save-MSCatalogUpdate -Update $Update -Destination ".\"
Id FileName
-- --------
0 proof-ar-sa_d140d14d65cf35bf269443bedf33a91ce25ced17.cab
1 proof-sl-si_7779ffad03046159c9fe46ea8b51cef2359ed043.cab
2 proof-ru-ru_ad51c3015fef4ec84c7bf1bd7ecea3ae50513001.cab
3 proof-fr-fr_cbaeb8d70abf4bdcdeab71b4e49a398ab683712c.cab
4 proof-ko-kr_8b46b86d03f85b4d086ca4d1660a7a21ac42f578.cab
5 proof-de-de_6b6827e86e0dc683245928c6b79dd4ac30347025.cab
6 proof-eu-es_545179291145aef04a5d52fa1a099b9d75fd9579.cab
7 proof-da-dk_ce1216eeb6613c13c05aef035d975244a30104c0.cab
8 proof-hu-hu_2836b2b61c069f8044fadff8da95a7fe863c8ac1.cab
9 proof-cs-cz_e770f507e123ad7041e0bebff98a56c52371ee9e.cab
10 proof-he-il_2f9d6065513e8b16f071b2cde122fa58af8dcfcf.cab
11 proof-en-us_1ae4178394992158748a482513090b4b34a4f14b.cab
12 proof-sk-sk_7deb8a95620b29d6ea18da89280f78a0d27f8483.cab
13 proof-ja-jp_3b98bb08afebd3008eb35b57a8ad6cfd8d7a3d3f.cab
14 proof-nl-nl_17cae97668c7823db00841fa29f21c2e7dd3d2f7.cab
15 proof-gl-es_06ad65e6d87f03024b134bfd1738fb1e5c0dbf73.cab
16 proof-pt-pt_9b20088d5ecc7b5667ee50ce62c05691f69f6b7b.cab
17 proof-zh-tw_85ba14c9118dbd2f8f45994bc2be9dd43bea0835.cab
18 proof-uk-ua_fa2c211f0338f05a7246c5f964dee232d1324c2d.cab
19 proof-tr-tr_4cebbef622cbc4ba57c4dbee0d599f43517c81ea.cab
20 proof-sv-se_a76dd4e3f8cd6cd3c78dda6f790e96288e1d342b.cab
21 proof-lt-lt_555e3ae1896c64e0bf4d090967441c84144f5fc0.cab
22 proof-it-it_1d501afe89d70168f85ea3ba4abf0f56530d5a07.cab
23 proof-nb-no_912c5a241d0cc0bdcb1558e80c5c2da43c364ed5.cab
24 proof-hr-hr_121779d22ece7a765d903506d73e0ac20753b5e8.cab
25 proof-pt-br_4881529c0171ea6208ce18b5de6c71684bad8976.cab
26 proof-et-ee_bd4fe166c78101ff937564677cac47a222be34d0.cab
27 proof-lv-lv_e7b24d89a2a72b1d8f3becef347ec49af736bbb0.cab
28 proof-th-th_57215ae8456dc0426c9a0a7b30c5c93c53fb93a7.cab
29 proof-el-gr_2f1ba04c2b0fb19ea1155c3d64a789e9a73b3684.cab
30 proof-ro-ro_62e712365bcb41cfb64417b228ee44d0a14b1a56.cab
31 proof-bg-bg_eaba8da224491f79802b27eceed9acfef68b56a4.cab
32 proof-sr-cyrl-cs_6f091498ad5b32e43838b6993cba9e32785aee61.cab
33 proof-zh-cn_de159b2b81701d56d070455fb63d062a8c84c31f.cab
34 proof-nn-no_5554397a926949767d64803f19296b18ca952c50.cab
35 proof-pl-pl_f911fda3832d574bd077a68b574565d8cd739f33.cab
36 proof-hi-in_0628542b025c310c8ccef630627acb6f33648909.cab
37 proof-ca-es_f6e24c8abd81d16ee14e4094e98419fccf19d224.cab
38 proof-sr-latn-cs_551d05fa7b113d467d36f394976992f95bd192b5.cab
39 proof-es-es_56697686e635a996b06b216fc3f0b4f7a49686f3.cab
40 proof-fi-fi_100b6b21d102186192a860630007c06026106b0e.cab
Multiple files exist for this update. Enter the Id of the file to download or 'A' to download all files.: 11
In order to avoid this prompt when downloading updates that are composed of multiple language files, Save-MSCatalogUpdate
has a Language
parameter. You can use this to specify the language to download, in the format language-country
; for example:
$Update = Get-MSCatalogUpdate -Search "Update for Microsoft Office 2013 (KB4011677) 32-Bit Edition"
Save-MSCatalogUpdate -Update $Update -Destination ".\" -Language "en-us"
Installing offline updates using wusa.exe
With the offline updates downloaded, you’re now ready to install them. For this, you’ll use the built-in Windows Update Standalone Installer tool, wusa.exe
. This process is very straightforward as there are only a couple of different parameters available to the wusa.exe
command.
The following example runs the wusa.exe
command to install an update (windows10.0-kb5003646-x64_ef50cfb8e8067dd27c13ae7c4150d20cb346b3bf.msu
in this case) file located in the current directory. This will run the installer interactively and will prompt for input as required.
wusa.exe ".\windows10.0-kb5003646-x64_ef50cfb8e8067dd27c13ae7c4150d20cb346b3bf.msu"
This is fine, but with most automated solutions, you probably wouldn’t want to have to interact with the installer. If this is the case, you can specify the /quiet
switch to suppress all user input and restart the computer/server as required; for example;
wusa.exe ".\windows10.0-kb5003646-x64_ef50cfb8e8067dd27c13ae7c4150d20cb346b3bf.msu" /quiet
Finally, if you’d rather not let wusa.exe
automatically reboot your computer/server without warning, you can use the /norestart
switch combined with /quiet
, as in the example below. This will not allow wusa.exe
to trigger any restarts and, therefore, you’d need to restart manually once the command completes.
wusa.exe ".\windows10.0-kb5003646-x64_ef50cfb8e8067dd27c13ae7c4150d20cb346b3bf.msu" /quiet /norestart
Conclusion
In this tutorial, you’ve learned how to install the MSCatalog PowerShell module, how to search for and download offline updates from the Microsoft Update Catalog site, and how to install these updates using the built-in wusa.exe
tool. Hopefully, this has been interesting to you and will help you when automating offline update tasks in the future. Thanks for reading!