Here is a simple registry trick to do so to prevent your computer from Pendrive Viruses.
Try this trick with care.
1. Go to start --> Run, type Regedit.
2. Go to HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlset \ Services \ USBSTOR
3. On the right pane, search for the value Start and have value as 0000000(3)
4. Double click on that and change that value to 4.
You might be required to restart the PC, and they you are done with it, USB is now blocked.