Forum Discussion
Get-WUHistory freezes
Hi,
Recently we compiled Powershell cmdlets to get the windows updates history and save it to our website. It works perfectly fine with Server 2016 and Win 10 but we also have customers with Win 8.1 and Server 2012 R2. Initially the Get-WUHistory didn't work because 2012 by default has Powershell 4.0 which I had to install Windows Management Framework 5.1
It did run the cmdlet 'Get-WUHistory' but for some reason instead of ending the script and going back to where you can type succeeding cmdlets, it just stops/freezes on the list of updates. I tried Ctrl and Break it will show stopping but never lets you type in a new command. Please see attached pic.
I used Powershell, Powershell ISE both run as admin and same thing
Thanks
TECH-JEFF
4 Replies
- VasuWindowsCopper Contributor
Me too face the same problem, observes this in our env too... Did you find any solution ?
Thx, Vasu
- mscottfordCopper Contributor
VasuWindows I ran into this as well. I went searching for the source code for the https://www.powershellgallery.com/packages/PSWindowsUpdate/2.0.0.4 module but I could not find a reliable source for that. Instead, I attached a debugger and tried to figure out what was going on. It looks like there's an infinite loop when the -Last parameter is not specified. So I'm working around this problem by making sure I specify -Last 100. The command reliably stops in that case.
Here's a full example for clarity:
Get-WUHistory -MaxDate (Get-Date).AddDays(-30) -Last 100I wish that this module's source code was hosted somewhere like GitHub because then I would be able to dig in deeper and hopefully provide a root cause fix to the problem.
- VasuWindowsCopper Contributor
Thansk much, it worked like charm . Great job mscottford