Script for Disabling Flash/Pen Drive in Win 7

i am using win 7 and i want a script to disable the flash/pen drive and enable it when required. when i was using xp there was a script which is not working in win7

This website is not affiliated, owned, or endorsed by Microsoft Corporation. It is a member of the Microsoft Partner Program.