The cause of the problem where your system turns off itself immediately after it is powered on before the operating system loads might be due to minor problem to major hardware problem. The following guidelines will help you determine the problem and help you fix this problem.
Listen for a beep code; the essence of beep code if you are able to hear and decipher one, is to give you an idea of what to look for (the problem causing your computer to turn off by itself). However, perhaps you did not hear the beep code or you are unable to decipher it, continue to troubleshoot the problem with the steps below.
Check to ensure that the power voltage switch is rightly set; if this input voltage for the power supply does not match that of your country, it might affect your system being powered. It is possible that your computer wouldn’t power on at all, if this switch is wrong but an incorrect power supply voltage might also cause your computer turn off by itself.
You need to check if there are electrical shorts, if there are, you will have to check for it causes. To do this, inspect inside your computer for possible electrical short causes (it is advisable you get a professional to do this). This is a really important step that can help you guard against unnecessary hardware replacement.
If the problem persist, you will have to clear the system CMOS, to do this, clear the BIOS of your motherboard, this will return BIOS setting to its factory default settings. A BIOS misconfiguration could be responsible for the problem, if this step solves the problem, ensure any changes you make in BIOS are completed one at a time so if the problem returns, you’ll know which change caused your issue.
Now, if you are still experiencing the problem you might have to remove and reset some components in your PC, this might just fix the issue as it may be caused by a component in your PC moving out of place. Some component you can consider resting are the internal data and power cable, PC memory module and also your PC expansion card.
Check inside your PC to make sure you do not have electrical shorts then cross check your power cables and its connections. At this point you might consider replacing your power supply as the PSU might actually be the problem.
Uninstall hardware from your system as excessive hardware connected to your PC might the cause. Then try to power it on, if it does power on then you need to reinstall the hardware.
The point here is, by reinstalling the hardware back into your PC and testing them often, you will probably find the hardware that caused the problem and then you can fix it.
After doing all these, you should be able to find the root cause of the problem and fix it, however, if all these steps fail to address the problem and your PC still turns by itself you will need to get a professional to salvage the situation.