Hi@LH64, Welcome to the HP Support Community!
Please capture the error code or message on the blue or black screen if it appeared before the computer turned off automatically, I would request you to follow the below steps to capture and reply back with the error message/code to identify the issue and find a permanent fix:
-
In Windows, search for and open View advanced system settings.
-
In the Advanced tab, under Startup and Recovery, click Settings.
-
Under System Failure, remove the checkmark next to Automatically restart, and then click OK.
-
Restart the computer to apply the change.
-
The computer no longer restarts automatically when a blue screen error occurs.
For more details: click here
However, if the computer shuts down and the lights on both the power button and the charger port turns off,
you may need to try with an alternate power adapter and reseat the battery before you try using it again
And if the issue persists, please Contact HP as this could be a hardware failure.
Please reply back with the error code as the issue is code specific and it would be rather easier to provide an accurate solution using the same.
Hope this helps! Keep me posted.
Please click “Accept as Solution” if you feel my post solved your issue, it will help others find the solution.
Click the “Kudos, Thumbs Up" on the bottom right to say “Thanks” for helping!
Have a great day!