HKEY_LOCAL_MACHINE > SYSTEM > CurrentControlSet > Services > USBSTOR
Now at the right side double click on Start.
To block USB storage Medias, change the value data to 4.
If you want to unblock USB storage Medias just navigate to the same location and change th value data to 3.
If you don’t want to bother tweaking registry then I’ve made a simple program to Block and Unblock USB device.