I updated the instructions by adding a line to the batch file with a command to kill the game input service before explorer.exe
I found that using bluetooth to connect my xbox controller would sometimes cause the error if I used sign off or put the computer to sleep instead of a shutdown or reboot.
Adding the line to kill the game input service seems to have eliminated that rare circumstance.
Here are the updated directions, if anyone wants to give it a go.
This is an updated way to eliminate the explorer.exe error message, regardless what’s plugged in, and whether you log off, shut down or restart the computer. It requires Win 10/11 PRO, or you need to enable group policy editor in home edition.
You can find that here
https://windowsreport.com/enable-gpedit-windows-11/
Caveat, this works for me but I can't say absolutely it will for you. These changes to the group policy will not harm you normal functioning in any way.
If you made this batch file when I posted before and want to edit the previous batch file, just right click the file, and select edit to insert the new line. Your group policy changes from before are still fine.
Start by making a batch file that kills the explorer.exe process, and the game input service
Open notepad and paste in these two lines.
NET STOP GameInputSvc
taskkill /F /IM explorer.exe
Save the file as Shut_Down_Script.bat or whatever you prefer to name it. Put somewhere safe, like your documents folder.
Use WIN+R to run gpedit.msc (Group policy editor)
In the left panel:
Drill Down to Computer Configuration > Windows Settings > Scripts (Startup/Shutdown)
Double Click Shutdown in the right panel and click Add
Browse to, and highlight the batch file you made, and click open , then OK, and Ok again
In the left panel:
Drill Down to User Configuration > Windows Settings > Scripts (logon/Logoff)
Double Click Logoff in the right panel and click Add
Browse to, and highlight the same batch file and click open, then OK, and OK again
Close the editor. Done.