以前写的一个批处理,主要用于禁用USB存储设备(包括U盘,移动硬盘等) 本文转载自http://novell.me
比例适用于企业网络环境,即用户端没有管理员权限的情况下。测试环境为Windows XP SP3,NTFS文件系统。
将以下内容存为.bat 或者.cmd格式的批处理文件,以管理员权限双击运行即可实现禁用USB存储设备。注意是存储设备。像USB鼠标和USB键盘是不会给禁用的。 本文引用自http://novell.me
@echo ************************************************
@echo . CopyRight
@echo . http://novell.me
@echo ************************************************
@echo off
cacls %SystemRoot%\inf\usbstor.inf /e /c /d system
cacls %SystemRoot%\inf\usbstor.inf /e /c /d "power users"
cacls %SystemRoot%\inf\usbstor.inf /e /c /d users
cacls %SystemRoot%\inf\usbstor.inf /r "everyone" /e
cacls %SystemRoot%\inf\usbstor.PNF /e /c /d system
cacls %SystemRoot%\inf\usbstor.PNF /e /c /d "power users"
cacls %SystemRoot%\inf\usbstor.PNF /e /c /d users
cacls %SystemRoot%\inf\usbstor.PNF /r "everyone" /e
cls
@echo Windows Registry Editor Version 5.00>>%temp%\usb_temp.reg
@echo [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\USBSTOR]>>%temp%\usb_temp.reg
@echo "Type"=dword:00000001>>%temp%\usb_temp.reg
@echo "Start"=dword:00000004>>%temp%\usb_temp.reg 本文转载自http://novell.me
@echo "ErrorControl"=dword:00000001>>%temp%\usb_temp.reg
@echo "ImagePath"=hex(2):73,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,44,00,\>>%temp%\usb_temp.reg
@echo 52,00,49,00,56,00,45,00,52,00,53,00,5c,00,55,00,53,00,42,00,53,00,54,00,4f,\>>%temp%\usb_temp.reg
@echo 00,52,00,2e,00,53,00,59,00,53,00,00,00>>%temp%\usb_temp.reg
@echo "DisplayName"="USB Mass Storage Driver">>%temp%\usb_temp.reg
@echo [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\USBSTOR\Security]>>%temp%\usb_temp.reg
@echo "Security"=hex:01,00,14,80,90,00,00,00,9c,00,00,00,14,00,00,00,30,00,00,00,02,\>>%temp%\usb_temp.reg
@echo 00,1c,00,01,00,00,00,02,80,14,00,ff,01,0f,00,01,01,00,00,00,00,00,01,00,00,\>>%temp%\usb_temp.reg
@echo 00,00,02,00,60,00,04,00,00,00,00,00,14,00,fd,01,02,00,01,01,00,00,00,00,00,\>>%temp%\usb_temp.reg
@echo 05,12,00,00,00,00,00,18,00,ff,01,0f,00,01,02,00,00,00,00,00,05,20,00,00,00,\>>%temp%\usb_temp.reg
@echo 20,02,00,00,00,00,14,00,8d,01,02,00,01,01,00,00,00,00,00,05,0b,00,00,00,00,\>>%temp%\usb_temp.reg
@echo 00,18,00,fd,01,02,00,01,02,00,00,00,00,00,05,20,00,00,00,23,02,00,00,01,01,\>>%temp%\usb_temp.reg
@echo 00,00,00,00,00,05,12,00,00,00,01,01,00,00,00,00,00,05,12,00,00,00>>%temp%\usb_temp.reg
@echo [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\USBSTOR\Enum]>>%temp%\usb_temp.reg
@echo "Count"=dword:00000000>>%temp%\usb_temp.reg
@echo "NextInstance"=dword:00000000>>%temp%\usb_temp.reg
cls
regedit /s %temp%\usb_temp.reg
del %temp%\usb_temp.reg
@echo off
cls http://novell.me 转载请注明出处!
本文地址 http://novell.me/master-diary/2010-01-16/disable-usb-disk.html
(责任编辑:Novell迷)