We created a script which checks for Windows Updates, installs the updates, creates a report and reboots if necessary.
This script runs in a single task and every system has it's own scheduled task. Unfortunately when I check the Script Output Results (where our report file is shown), I noticed the following error:
"Download Status: FAILED With Error -- You cannot call a method on a null-valued expression. The property 'Updates' cannot be found on this object. Verify that the property exists and can be set. Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))()"
(See the attachment for a more detailed Script Output, the script is also attached.)
I tried the following:
- Run the script locally on a system > Runs successfully. (Probably permission error?)
- Enabled the Powershell User Impersonation in the Pulseway Agent Manager (Administrator permissions) > Same error.
- Tried using SubInACL to fix (https://answers.microsoft.com/en-us/windows/forum/windows_7-windows_update/windows-update-error-0x80070005-need-a-fix-click/e4cb8700-f215-4f1a-8bd4-6457ac619c19) > SubInACL error: "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing - RegSetKeySecurity Error : 5 Access is denied." > Still not fixed.
I keep getting this error on a dosin of systems but can't figure out what the exact cause/problem is.
- Not Windows Server version related > Error occurs on multiple Windows Server versions.
- Script runs successfull locally on systems.
Output example.txt Script.txt