If your Windows 11/10 PC shuts down while installing or uninstalling a program, you need to follow the solutions mentioned in ...
Run an SFC and a DISM scan to repair any damaged files hindering the reset process. Read: Reset This PC not working in Windows 11 How to fix There was a problem resetting your PC in recovery mode?