2

Having an issue that I cannot seem to find any information on.

I'm using the Get-WindowsUpdate and Get-WUList modules in PowerShell to attempt to download and install Windows updates.

$windowsUpdateStatus = Get-WUList
while($windowsUpdateStatus.Value[0].Message -ne ""){
   Get-WindowsUpdate -Download -MicrosoftUpdate -AcceptAll -Install -AutoReboot
   $windowsUpdateStatus = Get-WUList
}

*Note that the conditionals in the script block above may not be 100% accurate

When this runs I can see that a handful of updates are installed in the console however when I go to the Windows Update UI it still shows the updates that were previously installed via the Get-WindowsUpdate call still need to be installed.

I've done checks with the Get-WUHistory and all other commands and they also show that the update is installed.

Has anybody else encountered this issue and is there a way to force that Windows Update GUI to refresh (other than by clicking the "Install Now" button)

  • What happens if you also run usoclient scaninstallwait this command should refresh the GUI. This can be run both from powershell or command prompt. – LPChip Oct 19 '23 at 14:13
  • @John - The intent of this script is to run off hours to enforce the install of all Windows updates so that they don't cause downtime during business' hours (I know Windows has an option to not push during certain hours but I don't have the ability to change that) – RussellLMiller Oct 19 '23 at 14:56
  • @LPChip - Let me find a fresh machine and get back to you on that. – RussellLMiller Oct 19 '23 at 14:57
  • @LPChip - Tried running that command from Powershell on a machine that was showing this issue and it unfortunately did not cause the UI to update – RussellLMiller Oct 19 '23 at 15:29
  • usoclient is deprecated by Microsoft, but it still works on my Windows 10 install. I was unable to test this on Windows 11, but I did test it also on Windows Server 2019 – LPChip Oct 19 '23 at 16:37
  • 1
    @RussellLMiller How about usoclient startinteractivescan? – Vomit IT - Chunky Mess Style Oct 21 '23 at 20:58
  • 1
    @Vomit IT - That seemed to do something. Unfortunately none of the machines are in a state where they have updates to install. Once I see the same issue I will try and report back but this does seem promising. Thank you! – RussellLMiller Oct 23 '23 at 12:24
  • @RussellLMiller Sounds good, I have some other ideas that may help if you continue to have issues. – Vomit IT - Chunky Mess Style Oct 23 '23 at 12:32
  • @VomitIT -- Let it run for a week and it seems to have worked, so thank you for that. – RussellLMiller Oct 31 '23 at 12:22
  • I did have a slight curveball, one of the users clicked the "Check Updates from Microsoft" and it was bringing back an update that I was not able to get from any Powershell or usoclient call. I was able to get it to find the update with the New-Object -ComObject Microsoft.Update.Session but could not get it to download successfully. Not super critical but was just wondering if you had run into that and had a solution – RussellLMiller Oct 31 '23 at 12:34
  • 1
    Yes, I believe it might be drivers and you have to run these sort of commands but see comments in the code too in case it's still applicable from when I ran that in the past: https://pastebin.com/rvxnwnWA. Also, look over the logic in my answer here: https://superuser.com/questions/1766039/powershell-microsoft-update-session-unable-to-download-all-updates/1766702#1766702 and consider some of that or those commands but in particular, the lines that removes: "c:\windows\SoftwareDistribution" as sometimes you have to stop WU service, purge that, start back up, check for updates again. – Vomit IT - Chunky Mess Style Oct 31 '23 at 15:05
  • 2

1 Answers1

0

Credit to VomitIT for this.

usoclient startinteractivescan

There are some edge cases but in general this worked!