Windows 10: Can't install updates with Powershell Windows update script after kb5040442

Discus and support Can't install updates with Powershell Windows update script after kb5040442 in Windows 10 Gaming to solve the problem; I am using the following script to update Windows images during Hashicorp Packer builds:... Discussion in 'Windows 10 Gaming' started by Norbert Végh, Jul 22, 2024.

  1. Can't install updates with Powershell Windows update script after kb5040442


    I am using the following script to update Windows images during Hashicorp Packer builds: https://www.powershellgallery.com/packages/AppVeyorBYOC/1.0.82/Content/hyper-v%5CWindows%5Cscripts%5Cwin-updates.ps1The script stops working on Windows 11 22h2 and 23h2 OS versions after installing the kb5040442 update.The script is printing the following after the update:There are 1 more updates> Note: has a license agreement that must be accepted. Accepting the license.Element not found. Exception from HRESULT@ 0x8002802B TYPE_E_ELEMENTNOTFOUNDAt A:\win-updates-22h2.ps1:74 char:21+

    :)
     
    Norbert Végh, Jul 22, 2024
    #1
  2. Kursah Win User

    PowerShell instead of Commandline in Creators Update

    Interestingly enough my personal laptop just got the update...and still has Command Prompt listed, not PowerShell...

    Edit: Not that it matters...I use both regularly. *Toast :toast:
     
    Kursah, Jul 22, 2024
    #2
  3. [Windows 10] hide/prohibit install of specific Windows Update

    Edit: Try "Show or hide updates" troubleshooter package first and let us know if it works for you.


    Adapted from Preventing a certain Windows Update from installing on Windows 10 by Igal Tabachnik.
    • Uninstall the problematical driver/update.
    • Restart the computer, if necessary, and/or switch to an administrator account.
    • Download Windows Update PowerShell Module and extract it to: %WINDIR%\System32\WindowsPowerShell\v1.0\Modules After doing so, you will have a %WINDIR%\System32\WindowsPowerShell\v1.0\Modules\PSWindowsUpdate folder with a bunch of files.
    • Start -> All Apps -> expand Windows PowerShell -> right-click on Windows PowerShell and select Run as Administrator. This is very important or you'll get errors in Windows PowerShell.
    • Now you should see the PowerShell window and you'll have to enter a series of commands. First order of business is loading up PSWindowsUpdate. Note: You have to do this every time you restart PowerShell and want to use PSWindowsUpdate commands!
      CommandDescriptionSet-ExecutionPolicy Unrestricted -ForceAllows the use of unsigned PowerShell scripts.Import-Module PSWindowsUpdateLoads PSWindowsUpdateSet-ExecutionPolicy Restricted -ForceClose the potential security hole.
    • Enter Get-WUList. This command will take a little while to execute. It retrieves the list of all available updates on Windows Update. If you do not see the problematical update here, it is either no longer being offered or it is installed.
    • Now you need to decide how to filter what update you want to hide. Here's some examples:
      CommandDescriptionHide-WUUpdate -Title "*Realtek High Definition Audio"This looks for a title that ends with (note the asterisk) "Realtek High Definition Audio"Hide-WUUpdate -Title "Realtek*"This looks for a title that starts with (note the asterisk) "Realtek"
      When you enter the above command, it will loop through all results it finds and ask whether or not you want to hide it. Make sure you only say "yes" to the one you want hidden and "no" to the rest.
    • It will automatically show the updated results. Verify there is an "H" under the status of the ones you want hidden and not behind the rest. If it is correct, close out of PowerShell and return to your normal user account if necessary. Run Windows Update and the update should not show/install.
    If you want to unhide an update, add -HideStatus:$false to the Hide-WUUpdate command.
     
    FordGT90Concept, Jul 22, 2024
    #3
  4. jds21 Win User

    Can't install updates with Powershell Windows update script after kb5040442

    Windows Updates failed to instal

    I just did step one and they have just all installed.... thank you so much.... it was quite frustrating having that update window pop up every 5 minutes and failing to instal every time

    Thanks mate
     
    jds21, Jul 22, 2024
    #4
Thema:

Can't install updates with Powershell Windows update script after kb5040442

Loading...
  1. Can't install updates with Powershell Windows update script after kb5040442 - Similar Threads - Can't install updates

  2. Runing powershell script from ISE after updating to Windows 24H2

    in Windows 10 Gaming
    Runing powershell script from ISE after updating to Windows 24H2: After updating Windows to 24H2 PowerShell scritps can not be executed from PowerShell ISE. The following error message is issued: Cannot dot-source this command because it was defined in a different language mode. To invoke this command without importing its contents, omit...
  3. Runing powershell script from ISE after updating to Windows 24H2

    in Windows 10 Software and Apps
    Runing powershell script from ISE after updating to Windows 24H2: After updating Windows to 24H2 PowerShell scritps can not be executed from PowerShell ISE. The following error message is issued: Cannot dot-source this command because it was defined in a different language mode. To invoke this command without importing its contents, omit...
  4. Windows Update KB5040442 Error

    in Windows 10 Gaming
    Windows Update KB5040442 Error: Hello,I am currently running Windows 11 Home 23H2 build 22631.3007.Specs: Processor 12th Gen IntelR CoreTM i7-12700 2.10 GHz Installed RAM 32.0 GB 31.7 GB usable Device ID C4FE7BEB-9FED-44BA-9185-3DF0DE9A4255 Product ID 00342-20956-74824-AAOEM System type 64-bit operating...
  5. Windows Update KB5040442 Error

    in Windows 10 Software and Apps
    Windows Update KB5040442 Error: Hello,I am currently running Windows 11 Home 23H2 build 22631.3007.Specs: Processor 12th Gen IntelR CoreTM i7-12700 2.10 GHz Installed RAM 32.0 GB 31.7 GB usable Device ID C4FE7BEB-9FED-44BA-9185-3DF0DE9A4255 Product ID 00342-20956-74824-AAOEM System type 64-bit operating...
  6. Can't install updates with Powershell Windows update script after kb5040442

    in Windows 10 Software and Apps
    Can't install updates with Powershell Windows update script after kb5040442: I am using the following script to update Windows images during Hashicorp Packer builds: https://www.powershellgallery.com/packages/AppVeyorBYOC/1.0.82/Content/hyper-v%5CWindows%5Cscripts%5Cwin-updates.ps1The script stops working on Windows 11 22h2 and 23h2 OS versions after...
  7. Pause windows update with a powershell script

    in Windows 10 Gaming
    Pause windows update with a powershell script: Hi,I am trying to remotley pause windows update using a powershell script.I have tried installing PSWindowsUpdate module on the remote PC and then running: Set-WindowsUpdateAutoUpdateOption -AutoUpdateOption 2This didnt work and i am getting that...
  8. Pause windows update with a powershell script

    in Windows 10 Software and Apps
    Pause windows update with a powershell script: Hi,I am trying to remotley pause windows update using a powershell script.I have tried installing PSWindowsUpdate module on the remote PC and then running: Set-WindowsUpdateAutoUpdateOption -AutoUpdateOption 2This didnt work and i am getting that...
  9. Require a Powershell Script for running Windows Update Troubleshooter

    in Windows 10 Software and Apps
    Require a Powershell Script for running Windows Update Troubleshooter: Hi , I am from Remote Support Team and need to troubleshoot some issues from the back end. Are there any Powershell scripts or .ps1 files for running the Windows Update Troubleshooter in the Windows 10 systems as I can't take the remote session of the client systems. Can...
  10. PowerShell Scripting - Update Windows 10 USB install media

    in Windows 10 Tutorials
    PowerShell Scripting - Update Windows 10 USB install media: How to: PowerShell Scripting - Update Windows 10 USB install media [img] Information A few weeks after release of Windows 10 version 1703 (Creators Update), Microsoft in April 2017 officially announced that Windows in the future will get biannual feature upgrades:...