Chosen Solution

I just acquired a 2012 macbook air. It shuts off when i try to restore it. It’ll connect to the wifi for internet recovery, but it shuts off before getting to the macos utilities screen. i tried removing the hard drive and booting off usb, but it does the same thing. The fan runs full speed the whole time. It will also turn itself on whenever you attach the magsafe or plug the battery connector back in, not sure if either of those are related. Any ideas? It will run through the hardware test fine, even the extended testing which takes like an hour.

At this point I would boot the system up in Target Disk Mode using a second system. Then if it had anything important back it up, if not I would wipe the drive and re-install a fresh copy of OS. You do want to be careful here as you don’t want to install anything newer than what it had before. It sounds like you have a virus or malware running.