Found this topic when searching for a solution for my wife's HP 250 G4, which was going off apparently at random. Found that the problem persisted even if I went into BIOS or HP Diagnostics without letting Windows start so was able to discount a Windows issue. Diagnostics would run without finding any errors for sometimes an hour, then click off it would go. Deteriorated to the point that it wouldn't even stay on long enough to start diagnostics. FOUND THE SOLUTION! It was the integrated on/off and lid detection circuit board that had gone defective making the machine think that the lid had been closed. This is a tiny PCB about 30mm x 10mm which sits just above the DC power socket and beneath the left side hinge. A fiddly replacement due to the WIFI aerial and screen cables which go through the LH hinge. Found a replacement on line. Problem solved, machine ran diagnostic for over 4 hours without shutting down or going to sleep. Job done.
Be alert for scammers posting fake support phone numbers and/or email addresses on the community. If you think you have received a fake HP Support message, please report it to us by clicking on "Flag Post".