Hello and welcome to my blog,
sometimes windows updates don’t get installed simply because WUSA stuck and need to be restarted. In many cases, erasing the folder “Software Distribution” is also required in the solution. In this thread, I will show you the PowerShell I use
net stop wuauserv
Remove-Item -Recurse -Force 'C:\WINDOWS\SoftwareDistribution'
net start wuauserv
as you see, the above code does the following: Stop WUSA, then Delete the Software Distribution folder. And lastly it Start WUSA again. Dont forget to run the above code in admin privileges
Feel free to use the code on your responsibility in your automation tasks.