Question: I am trying to make a program that when a usb is plugged into the computer it will lock the usb, so it is not accessable, and then when the user enters the correct password the usb will be accessable.

Is this possible?

Any help would be appreciated,
Thanks.

Answer: 
I found several articles by googling "[usb policy c#](http://www.google.com/search?q=usb+policy+c%23)". [Here's the first one](http://knol.google.com/k/developing-usb-storage-device-protection-tool-with-c#) and it looks straightforward. The results also showed some CodeProject hits, which you can usually download and learn from.
What you are talking about is called "device control" in the security world. Commercial solutions exist in many flavours (Google it or take the question to [SF](http://serverfault.com)/[SU](http://superuser.com)) but unfortunately I think it's quite complicated to implement on your own. In particular I think you would need to modify the device drivers in the USB layer, which in turn might disqualify C#. You would also need to whitelist certain devices or types of devices, for example your keyboard.

You could perhaps disable USB completely (in the BIOS for example), if it's a notebook and you don't strictly need USB for a keyboard or anything.