I have two GnuPG smart cards that I use to store GPG authentication keys on. One is a Yubikey nano, which I keep in my device most of the time, while the other is a Yubikey 5 NFC which I keep on my physical key ring. Often I need to use the GPG keys that are on my 5 NFC but GPG4Win seems to have a real hard time with multiple smart cards plugged into the computer at the same time.
The problem I was having is that the Yubikey nano is really hard to remove from the PC (as designed), so when I need the keys on the 5 NFC it is preferable not to have to remove the nano. On a Mac computer this problem is mitigated with a application called YubiSwitch but it does not exist for windows.
After some messing around I found a quick solution, but it does require the devcon.exe tool from Microsoft. So please keep that in mind that I installed Visual Studio and then the WDK to get the devcon tool (there may be another way to get this tool).
The following is the solution I came up with to disconnect and then subsequently reconnect the Yubikey Nano in Windows 10.
Disconnect the Yubikey nano by using windows tool to eject the device ( click the USB icon in the system tray and then select “Eject YubiKey OTP_FIDO+CCID”
At this point you can then insert the new smart card and do your business. When complete, lets reconnect the Yubikey Nano by executing the script with the following commands in it.
"c:\Program Files (x86)\Windows Kits\10\Tools\x64\devcon.exe" disable "USB\VID_1050&PID_0407&REV_0512" "c:\Program Files (x86)\Windows Kits\10\Tools\x64\devcon.exe" enable "USB\VID_1050&PID_0407&REV_0512" "c:\Program Files (x86)\Windows Kits\10\Tools\x64\devcon.exe" disable "USB\VID_1050&PID_0407&REV_0512" "c:\Program Files (x86)\Windows Kits\10\Tools\x64\devcon.exe" enable "USB\VID_1050&PID_0407&REV_0512"
I put the script on my Desktop so I can quickly reattach when I need. Note that the USB\VID_1050&PID_0407&REV_0512 is the hardware Id for the YubiKey Nano. The first disable/enable lines in there brings the Nano back to a state where it is seen by Device manager but it says it still needs to reboot in order to use it. Doing this disable/enable a second time seems to bring it back to life.
Got this idea when researching how to do this and stumbled upon this page. It talks about how to do this with USB mass storage devices and I just modified it to meet my needs (essentially finding and changing the Device ID used by devcon.exe). I hope this helps someone else out there that has the same problem.