Free USB Guard will alert you in case a flash drive (or another external drive) is attached during the shutdown or log off process. The shutdown or log off will be blocked allowing you to take out the flash drive. The software can also detect them only if they are plugged after the software has been started. Otherwise you can select them manually in the menu "monitor the presence of these drives".
||Microsoft.NET Framework 2.0