天天看点

你的计算机usb管理策略,域策略禁用USB的问题,求解惑。。。

写过2个批处理做这个封USB,一个关闭,一个开启。统一分发关闭。需要开启的,单独发他让他执行。

关闭

@echo off

reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\ControlStorage\DevicePolicies" /v WriteProtect /t reg_dword /d 1

reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\USBSTOR" /v Start /t reg_dword /d 4 /f

copy %Windir%\inf\usbstor.inf %Windir%\usbstor.inf /y >nul

copy %Windir%\inf\usbstor.pnf %Windir%\usbstor.pnf /y >nul

del %Windir%\inf\usbstor.pnf /q/f >nul

del %Windir%\inf\usbstor.inf /q/f >nul

@echo on

开启······执行完毕需要手动操作扫描硬件改动,应该也可以写到批处理里自动执行,懒得研究了。

@echo off

reg delete "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\ControlStorage\DevicePolicies" /v WriteProtect /f

reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\USBSTOR" /v Start /t reg_dword /d 3 /f

copy %Windir%\usbstor.inf %Windir%\inf\usbstor.inf /y >nul

copy %Windir%\usbstor.pnf %Windir%\inf\usbstor.pnf /y >nul

del %Windir%\usbstor.pnf /q/f >nul

del %Windir%\usbstor.inf /q/f >nul

@echo on