i know that you wanted C# help but leave it.
i did a script using a batch, working like a charm.
i got 500 "media locked" computers on my company.
i attched 2 zip files.
in each file there are 3 .REG files.
lock_USB.reg - Locking just usb mass storage device (disk on key and other storage devices) it isn't locking usb mouse ,printers, scanners etc.
lock_CDROM.reg - Locking CD-ROM
lock_Floppy.reg - Locking Floppy disk
unlock_USB.reg - disables the lock on the usb
unlock_CDROM.reg - disables the lock on the cdrom
unlock_Floppy.reg - disables the lock on the floppy disk
just import the files into the registry and walla !
the cd_rom and floppy disk locks needs to restart in order th apply.
You can import the .REG files into the windows registry using batch file (to do a statup script on GP or any other way):
regedit /s [name of the reg files]
regedit /s lock_USB.reg
You can either change the registry keys using c# or any other way.