*These actions are only possible with administrative privileges.

Prerequisites

Install the update module:

Install-Module PSWindowsUpdate
Add-WUServiceManager -MicrosoftUpdate

Command

Install all availble updates

Install-WindowsUpdate -MicrosoftUpdate -AcceptAll -AutoReboot | Out-File "C:\MSUpdates.log" -Force

Update logs can be found at: C:\MSUpdates.log

screenshot of the log file

that’s it <3