Use PSWindowsUpdate in MEMCM Task Sequence

You can use the PSWindowsUpdate PowerShell module from Michal Gajda to install updates for Windows, Office, drivers, and firmware directly from Microsoft. This post explains how you can use it in a MEMCM Task Sequence and replace the default “Install Software Updates” step that uses WSUS.

PowerShellGet and PackageManagement

PowerShellGet is a PowerShell module with commands for discovering, installing, updating, and publishing PowerShell artifacts like Modules, Scripts, and DSC Resources. It is dependent on PackageManagement (formerly known as OneGet) to discover and install software packages from around the web.

An out-of-the-box Windows 10 installation does not contain the latest PowerShellGet and PackageManagement modules, which other PowerShell modules, such as PSWindowsUpdate, require.

Updating these modules with the Install-Module cmdlet in a Task Sequence will not work. The easy way to do this is to manually update the modules on a client system, export, and file copy them during deployment. This is also required for the PSWindowsUpdate module.

Manual update PowerShellGet module (PackageManagement will update automatically):

Install-Module -Name PowerShellGet -ForceCode language: PowerShell (powershell)

Install PSWindowsUpdate module:

Install-Module -Name PSWindowsUpdate -ForceCode language: PowerShell (powershell)

The modules will be installed in C:\Program Files\WindowsPowerShell\Modules:

Save the PowerShell modules to a location that is accessible for MEMCM:

Save-Module -Name PowerShellGet -Path C:\Temp\PowerShellModules
Save-Module -Name PSWindowsUpdate -Path C:\Temp\PowerShellModulesCode language: PowerShell (powershell)

Task Sequence

Create a MEMCM package with these modules as a source:

Create a step to copy the PowerShell modules to the PowerShell directory:

Add a second step to run a PowerShell script and click on “Edit Script”:

Copy and paste the script from my GitHub:

The Task Sequence will automatically reboot the system as long as there are updates available and continues when they are all installed.