I have a problem with my hp envy 17 laptop. "My laptop just now shut down on its own. Not a regular shutdown, not even a bluescreen. It was like a regular PC without a UPS having its power cord janked out of the socket. " Just like this. And it restarts automatically after two seconds. Sometimes it shuts down after 3 minutes, sometimes after 1 hours. There is no battery, power supply problem. I tried everything about it. I updated bios, turned off second nvidia gpu, cleaned laptop, changed thermal paste, changed ram, formatted windows. Nothing changed.
Sound like a hardware issue. Something is perhaps creating an internal reset. One place you may look is the event log. Soon after a restart, type Event in the Windows search bar and open Event Viewer as an admin. Give the program several seconds to read the logs then look at the Summary of Administrative Events. You may see several errors and warning in the last hour column. Double click on them to see details. If you are very lucky, you will see an event that occurred prior to the restart. What you are more likely to see is an event that says something like unexpected restart. That would support the notion that something is resetting your hardware. Figuring out what is difficult. Mucking around inside is not likely to help and more likely to break something else. It may need to go back to HP. I've owned a couple HP laptops and had to send one back for repairs. Good experience except it came back with the SSD restored with a fresh OS and all my data gone. I expected that and had backups. Sorry I can't be more helpful. There are ver few ways for software to just restart that way without a blue screen. A reset instruction is very priviledged and can't be issued by any user software.