This original tip Restrict USB pen drive access on XP networks was submitted by Mithun Kanji, but I've expanded...
on it to work for my needs. Thanks to Kanji for the inspiration.
The USB storage/disk/thumb drive installation mechanism on XP machines works with two files stored in the Windows/Inf folder: usbstor.inf and usbstor.pnf.
To disable this function, you must deny access to the "System" built-in user group for the XP machine.
For network implementation, create a file named USBdisable.vbs and copy and paste the code provided. Save file in Netlogon folder on PDC. Manage users in AD and select desired OU (e.g. Lamers OU) to apply restriction to and right click. Select properties, Group Policy, New, Modify name (e.g. Lamers GPO), and Edit.
Go to User Configuration | Windows Settings | Scripts | Logon | Add. For Script Name, select Domain SysVol | Domain | Scripts and select file name USBdisable.vbs. Click OK and exit out.
Now whenever a user who is in that selected OU logs on, the script runs and replaces all the rights for those two files, thus disabling the Plug and Playability of any USB storage device.
To enable the feature, modify the code with a ":f" for "Full" access to the file by the System and save the code to a file name called USBenable.vbs. Follow the same proceedures above but apply the logon script to OUs other than the Lamers OU (which has the USBdisable logon script).
Dim WshShell Set WshShell = WScript.CreateObject ("WScript.shell") WshShell.run "cmd /C echo y| cacls c:windowsinfusbstor.inf /p system:n" WshShell.run "cmd /C echo y| cacls c:windowsinfusbstor.pnf /p system:n" Set WshShell = Nothing
Please let us know how useful you find this tip by rating it below! If you have a useful Windows tip, timesaver or workaround to share, submit it to our tip contest and you could win a prize!