I am able to do everything else just about, but when I try and run Windows Update with the PSWindowsUpdate module, I get access denied from Remote system everytime. Ive seen a large number of posts online with the same issue. I was wondering if this can actually be done. I dont have my script that fails in front of me, Ill post it tomorrow when I do.
I have a bunch of tasks and wanted to minimize the amount of logging into the servers. But at the end of the day I will still need to login at least 1 time, so yea I can kick the update off then.
Check the scripts that the Windows Admin Center team uses.
The Description of Install-WindowsUpdates has a note that you should find telling.
Create a scheduled task to run a powershell script file to installs all available windows updates through ComObject, restart the machine if needed.
This is a workaround since CreateUpdateDownloader() and CreateUpdateInstaller() methods can’t be called from a remote computer — E_ACCESSDENIED.
More details see Using WUA From a Remote Computer - Win32 apps | Microsoft Docs