Is a new motherboard. We try to avoid that by popping in a new CMOS battery just in case. But here I have to write I never wrote this will fix it. The battery we buy in bulk is 25 cents so we change it since to test it costs more.
Next we remove HDD, ODD, memory and WiFi (depends on model) and see if the power stays up. If it does we power down and slip in one memory stick.
BEFORE all that we perform a generic reset by removing power, then battery and holding the power button for 60 seconds. Release the power and apply the charger without battery (it could be bad.) And test.
If all that fails it's usually the motherboard.
I have a Dell Inspiron N5010, when I turn it on, the laptop runs for only 2 minutes and I already checked the fan works and it's clean. I do not know why the PC automatically shuts down if someone knows why?, if someone know I will thankfully.