I had the same shut down problem. HP help suggested I tap F10 during start up, this brings up the BIOs page, go to test along the top menu and run the test. It came up with a fault code which meant that the hard disk was about to fail! In othe words get it fixed quick.
Hope this helps.