Windows Repair got my firewall fixed, thanks for the excellent and easy to use tool. I still had problems with Windows Defender. The registry entry below fixed Defender start.
The registry needed corrected MsMpRes.dll resides in Program Files not Program Files (x86)
from
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\WinDefend]
"DisplayName"="@%ProgramFiles(x86)%\\Windows Defender\\MsMpRes.dll,-103"
to
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\WinDefend]
"DisplayName"="@%ProgramFiles%\\Windows Defender\\MsMpRes.dll,-103"
not sure if this error is in your scripts or multiple problems were on this machine.