- Change Windows network profiles between public and private - Wed, May 24 2023
- How to map a network drive with PowerShell - Wed, May 17 2023
- Troubleshooting no network or internet in VMware Workstation - Thu, May 4 2023
While most Windows features have long supported detailed automation via PowerShell, this option was missing for the update client; it is now available to a limited extent. Compared to the popular PSWindowsUpdate by Michal Gajda, Microsoft's own module is less powerful.
Availability as an advantage
The main advantages of Windows Update Provider are its official support by Microsoft and that all newer versions of the operating system already have it on board. Therefore, when using it for remote management, you can assume that the required functions are already available on the target computer. In contrast, third-party modules must first be installed on every managed PC.
However, it is not possible to copy Microsoft's Windows Update Provider to older versions of Windows, such as Server 2012 R2 or 2016, because the CIM class required by the functions does not exist on those versions.
More control over updates
Command line tools such as usoclient.exe, wuinstall, or PowerShell cmdlets give admins more control over the update process because they can explicitly request the scan, download, install, or restart. This is useful, for example, if you want to secure a freshly installed computer by installing the latest patches. In addition, PowerShell is useful on Server Core because there is no GUI for managing updates.
Overview of the range of functions
If you search for Windows Update modules using
Get-Module -Name *Update*
then the command returns two results. While one of them is WindowsUpdate, the module only contains a function called Get-WindowsUpdateLog.
The commands intended for the management of the update client can be found in WindowsUpdateProvider. They can be listed with:
Get-Command -Module WindowsUpdateProvider
As you can see, these are not cmdlets but only functions.
For example, if you want to display the contents of Start-WUScan with
Get-Content Function:\Start-WUScan
then you can see that this function operates on the basis of the CIM class MSFT_WUOperations. The same applies to Install-WUUpdates.

The functions of the WindowsUpdateProvider module use the methods of the CIM class MSFT WUOperations
While Get-WULastInstallationDate and Get-WULastScanSuccessDate are used to examine previous updates, and Get-WUAVersion outputs the version of the client, the three remaining functions provide the actual update management.
Checking for updates
As the name suggests, Start-WUScan looks for available updates. You cannot specify a source for updates; rather, the function queries the update server configured on the computer. This is a WSUS server in most cases.
If you don't specify any parameter, all updates that apply to the system will appear in the results. The only way to restrict the list is with SearchCriteria, which you have to pass a search expression:
Start-WUScan -SearchCriteria "Type='Software' AND IsInstalled=0"
The permitted search criteria follow the syntax described in the API documentation, but Microsoft does not offer any specific information on WindowsUpdateProvider as a whole.
For example, it is practical to query remote computers to find out whether a specific update is installed there. Since the ComputerName parameter is not supported, you have to use the Invoke-Command:
$u = Invoke-Command -ComputerName MyPC -ScriptBlock {Start-WUScan -SearchCriteria "UpdateId='<GUID-of-Update>' AND IsInstalled=1"} -Credential admin\contoso
After executing the command, the variable $u will contain all updates which match the search criteria.
Downloading and installing updates
If you want to install pending updates, you have to save the result of Start-WUScan in a variable, as in the example above. You then pass this on to Install-WUUpdates. But first you establish a CIM session on the remote computer:
$cs = New-CimSession -ComputerName MyPC -Credential Credential admin\contoso Install-WUUpdates -Updates $u -DownloadOnly -CimSession $cs
This example command only downloads the updates.
You then initiate the actual installation by executing Install-WUUpdate once more without the DownloadOnly switch:
Install-WUUpdates -Updates $u -CimSession $cs
Querying pending reboot
If the computer must be restarted after installing updates, you cannot initiate it via Install-WUUpdates. However, it is possible to query whether a reboot is pending with another function of this module:
Get-WUIsPendingReboot
If the command yields the value $true, then you can reboot the PC at the desired time using the Cmdlet Restart-Computer.
Get-WUIsPendingReboot can also be used to query a pending reboot of a remote computer.
The function simplifies this task considerably compared to the method that looks for it in the registry.
Subscribe to 4sysops newsletter!
Conclusion
With the WindowsUpdateProvider module, Microsoft has provided the basic functions for managing updates via PowerShell, beginning with Windows 10 1709 and Server 2019. They are particularly suitable for updating computers remotely. However, the integrated module does not come close to the capabilities of PSWindowsUpdate.
Thanks for the article, just a confirmation, this is only for Windows Server 2019 and not for 2016 ?
Paolo, that’s correct!
Get-Module -Name *Update* -ListAvailable
will only show the Module WindowsUpdate on Server 2016
Thanks Wolfang for your confirmation.
Your comments are confusing guys 🙂 The article speaks about Win2019, Paolo asked about Win 2019, Wolfgang replied its only available on Win 2016 and Paolo did say thanks :)))))
Leos, sorry for confusing you 🙂 The module WindowsUpdate doesn't contain the cmdlets described in the article. You need WindowsUpdateProvider which is not available in server 2016 but in 2019
Dont worry, you got it correctly in the post, hehe 🙂
Ah damn, now I understand what you meant… HAHA, sorry, my mistake… 🙂
No problem.
I guess this is the same thing that the WIMwitch.ps1 script you wrote a while ago is using?
Hello everyone,
I did a clean install of Windows 10 2004 (the gold code was posted on Visual Studio/MSDN a few weeks ago) and can't find "WindowsUpdateProvider". Am I doing something wrong or did something change?
PS C:\> Get-Module -Name *Update*
PS C:\>
PS C:\> Get-Command -Module WindowsUpdateProvider
PS C:\>
Hi Richard, you are right. Just checked Windows 10 2004 for this module. Microsoft has removed it. And it's not even possible to copy it over from a previous version. You will get an "Invalid namespace" CIM exception.
Hi,
Same issue: Windows 10 Pro 2004, having issue with this module throwing errors.
Anyone know of a replacement module to use or what the story is?
(I am also having other odd experiences but unrelated to updates so wont comment on that here).
Does the operation "Start-WUScan" update the "Last checked" date and time in the GUI ?
This has been a problem using cmdline or API to perform a scan.
Sounds to me like the creator of the PSwindowsupdate module is about to get paid!