Chosen Solution

iMac powers on gets through start up etc but after say 2-3 mins it shuts off & restarts

The first thing I would look at on this model is the capacitors on the power supply. Look for swollen and/or leaking ones. You may be able to actually fix this power supply rather than repairing it. iMac Intel 21.5" EMC 2389 Power Supply Replacement

Does it have a cooling fan and is it working? Could be overheating. If you are proficient enough and have spare parts you can swap out the RAM and try running the machine without unnecessary hardware (CD drive, HDD) to see if it stays on longer than 2 mins.