open the Event Viewer. On the left in the Event Viewer, go to Windows logs – System, in there you should be able to trace if something is wrong and causing your PC to shut down.
Run as administrator command prompt
SFC /scannow
Dism /Online /Cleanup-Image /CheckHealth
Dism /Online /Cleanup-Image /ScanHealth
Dism /Online /Cleanup-Image /RestoreHealth
DISM /Online /Cleanup-Image /StartComponentCleanup
SFC /SCANNOW
DISM /Online /Cleanup-Image /AnalyzeComponentStore
SFC /SCANNOW
REM reboot
pause
Dism.exe /online /Cleanup-Image /StartComponentCleanup
chkdsk C: /f /r /x
Open your Windows Security settings.Select Virus & threat protection > Scan options.Select Windows Defender Offline scan
Type in “CMD” and hit enter
Type “WMIC” and hit enter
Type “diskdrive get status” and hit enter