If the Mayfly board still works when powered from a battery, then there’s a couple of possibilities of why the computer might not see it. One is that the main power slide switch is defective, since that switch does 2 things – one pole is to provide power to the regulator that powers the whole board, the other pole is to provide power to the FTDI USB-to-UART chip on the Mayfly (FT232RL) that normally allows the computer to “speak” to the Mayfly board. Sometimes one or both poles of the power switche can go bad if there’s a little bit of corrosion or dust inside the switch housing. This can usually be remedied by rapidly sliding the power switch back and forth a few times.
The second (and probably more likely cause since you have 2 bad boards acting the same) is that a bad microUSB cable damaged one or more of the pins inside the little microUSB jack on the Mayfly. Without all of the pins properly functioning, the computer won’t be able to communicate with the Mayfly.
There is a 6-pin header near the Mayfly’s SOLAR jack that can be used to program the board without using the onboard microUSB jack or the FTDI chip. This is how I usually program all of the thousands of Mayfly boards I’ve used in the past few years because it is much easier than having Windows assign a new COM port for each new Mayfly that I connect to my computer.
I’d suggest ordering one of these FTDI programming boards: https://www.amazon.com/Adafruit-FTDI-Friend-Extras-ADA284/dp/B00NAY1VJ2
It comes with a little 6-pin coupler to allow you to plug it right into the FTDI jack on the Mayfly. And because it uses the same FT232RL chip that’s on the Mayfly (v0.5b and earlier), you shouldn’t have to install any new software drivers on your computer. Windows will, however, assign a new COM port to this new FTDI board, so you’ll have to look for that under your Arduino IDE’s Tools–>Port list.
Be sure to plug it into the Mayfly in the direction shown in the attached photograph, otherwise you’ll be connecting the power and ground pins to the wrong pins and it won’t work. This FTDI board uses a the older style miniUSB jack, which is larger than the microUSB jack on the Mayfly, so make sure you’ve got one of those cables instead of the one you used for connecting directly to the Mayfly.