Howto initiate Windows Update on server core from a PS remote session?

You can't actually trigger that directly over winrm/winrs.

A somewhat popular powershell module (PSWindowsUpdate) for performing Windows Updates from Powershell exists, and to perform updates on a remote system it actually copies the module to the remote system and schedules a new one-time task on the remote system.

In the invoke-WUInstall.ps1 file it has this comment about remotely triggering an update.

Use Invoke-WUInstall to invoke Windows Update install remotly. It Based on TaskScheduler because CreateUpdateDownloader() and CreateUpdateInstaller() methods can't be called from a remote computer - E_ACCESSDENIED.


FWIW, on Windows Server 2019, you can use

$u = Start-WUScan
$b = Install-WUUpdates $u

The array $u tells you what updates are available, if it is empty, you are done.

The boolean $b tells you whether a reboot is required. After rebooting, you should scan for updates again.