is almost always due to an overheating problem. If it boots fine and then shuts down, something is overheating or motherboard part has failed. Be sure the CPU has new thermal paste between it and the HSF.
Ok so I have hp laptop out of warranty which turns of itself after 10-15 seconds..i checked it,the fan is working properly and hdd is also fine..whatever I do,it just shuts down in 1-10 secs...i gave it to two repair centers,and they said that they need to replace the mother board as they didn't got to the exact problem..but getting new motherboard is costly,so need to figure out the problem myself and try to fix...can anyone help me??i can attach the photos if someone wants...i have tried cleaning the fan and applied thermal paste on the cpu and removed the old one..

Chowhound
Comic Vine
GameFAQs
GameSpot
Giant Bomb
TechRepublic