I do think the script is a bit of a sledgehammer to crack a nut approach and not directly addressing that the issue is caused by the Ransomware module of Malwarebytes.
Note also that although the logs info shows Avast in use, I can assure that it is NOT installed on the system.
There's nothing wrong with Windows Update, working well in fact, so I don't see why that needs resetting.
Nor the network settings, Steam cache, Cookies, because 4 machines show this behaviour and all those items will be different on each machine, as will be CPUs and drives.
Windows Temp is regularly emptied and SFC and DISM commands show a clean system.
Please advise what you suspect might be wrong and not just recommend a thorough machine cleanup.
Happy to target specifics manually.