You'll probably need to replace the motherboard. Those models HP/Compaqs are known for this. When it does not turn on, do all the status lights go on?
I am able to get it to boot to Windows if I run directly off of AC power. However, once it is on, it will eventually turn off without warning.
If I have a battery pack in, it will flash the three front lights blue but the system will not start.