Tip

Restrict USB drive access on Windows XP redo

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).

Code:

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!

This was first published in October 2006

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.