iMac shuts down randomly for no apparent reason
In late August of this year, after the plug came out of the back of my iMac when I was attempting to adjust the angle of the screen while the computer was on, the computer began shutting off for no reason while on. I took the iMac to the Apple Store in El Paseo, in Palm Desert. They replaced the 3 TB fusion hard drive saying that there had been a history of problems with this. I received the iMac back and shortly thereafter began to shut down once again for no reason. I brought it back to the Apple Store and they deleted some software and removed some software that were automatically engaging at startup. The iMac began to shut down for no reason once again. I brought it back in and they ran a full diagnostic test and could not find any problems. It worked for a while and then began to shut down for no reason again. I brought it back in to the Apple Store in this time I was advised that there are going to run more extensive hardware testing, running it through longer cycles etc. They could not find the problem and suggested that it was likely an effect of peripherals I had connected to the iMac. I disconnected all the peripherals from the iMac and began testing them one by one over time. The iMac still shut down for no reason at random times. I ran the computer with no peripherals connected at all, and it still shut down for no reason. I have run Apple diagnostics and it found no trouble. I have run malware detection software and it found some things that were then deleted. I did this very early before I even brought to the Apple Store. I ran antivirus scans, full scans on the iMac and it found no infection. I also ran fan control software to see if the iMac was overheating and even with the fans at the full rpm setting, the iMac still shut down at random times. I used a rocket air blower that I used to remove dust from my camera lens to try to blow through the back vent and the bottom screen vents to free that of any buildup of dust, and it still shut down for no reason. What could possibly be the issue with this machine after all the testing and interventions that have been done?
Late 2012 iMac - Quad Core Core i7- 16GB, 3TB Fusion Drive
iMac, OS X Yosemite (10.10.4), Mac (27-inch, Late 2012) 3.4 GHz