Initially my computer was restarting most of the time when trying to shut it down. I disabled the shutdown on error thing as well as the regedit poweronshutdown from 0 to 1, even after that it sometimes still restarted but now it seems to just be hanging on shutdown with everything running still showing the 05 q code on the motherboard.
I have checked drivers and bios are up to date (they were) I have checked the eventviewer can't see anything there as far as I can tell. I have checked the power on LAN stuff in the BIOS as well as Windows. I have done selective boot slowly increasing processes running and thought I narrowed it down to the microsoft WWAN and WLAN drivers but then it still did it sometimes. I have done various other software related tests and the more I do the more random it seems.
Someone suggested it may be the pins in the motherboard connecting the power button in the case, but it's not that. Also tried unplugging certain USB devices and that doesn't seem to help either. I'm really fresh out of ideas!