用AD域組策略來實現USB 只讀、讀寫、禁用的管控


用AD域組策略來實現USB 只讀、讀寫、禁用的管控

 

前提

1、windows2008R2中,針對USB的管控策略不支持winXP;

2、傳統修改注冊表的形式,在插拔U盤設備后會被USB驅動自動重置鍵值破解;

 

已知問題:

1、禁用后的USB被啟用后,IPHONE手機無法連接計算機;

 

方案:

為了細化USB權限分級,增強USB權限管控,降低數據泄露的風險,經討論決定對OU的USB管控策略進行升級。對申請權限細化為只讀、讀寫、禁用三類。

 

 

通過計算機策略分別實現USB的開啟、只讀、禁用權限管控。

對計算機OU進行調整,建立下級子OU,以對應三種權限。

考慮windows2008R2域控不支持XP的USB管控策略,使用腳本對注冊表和驅動文件進行改寫,以支持XP系統。

 

1、  制定3個組策略分別對用三級權限

A:禁用:

策略

設置

注釋

CD    和 DVD: 拒絕讀取權限

已啟用

 

CD    和 DVD: 拒絕寫入權限

已啟用

 

軟盤驅動器: 拒絕讀取權限

已啟用

 

軟盤驅動器: 拒絕寫入權限

已啟用

 

所有可移動存儲類: 拒絕所有

已啟用

 

 

啟動腳本:QD-No-usb.bat

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

\\修改usbstor值為4,禁用usb

reg add  "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\StorageDevicePolicies"  /v "WriteProtect" /t reg_dword /d "1" /f

\\添加建值writeprotect=1,usb設置只讀(保證權限)

ren C:\Windows\Inf\usbstor.inf  usbstor.inf1

\\改名usb驅動,准備替換,不改名無法輸出新驅動

@echo off&setlocal  EnableDelayedExpansion

for /f "delims=" %%b in ('type  C:\Windows\Inf\usbstor.inf1') do (

set "str=%%b"&set  "str=!str: 3= 4!"

\\對改名的USB驅動內容進行修改 3修改為4(數字前有空格),避免驅動自動修復注冊表

echo !str!  >>C:\Windows\Inf\usbstor.inf

\\輸出修改的驅動文件

)

 

\\del C:\Windows\Inf\usbstor.inf1

ren C:\Windows\Inf\usbstor.inf1 usbstor_back.inf1

\\刪除改名的文件(最好不刪除,重命名備份)

 

B:讀寫權限

 

啟動腳本:QD-RW-usb.bat

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

reg delete  "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\StroageDevicePolicies"  /f

ren C:\Windows\Inf\usbstor.inf  usbstor.inf1

@echo off&setlocal  EnableDelayedExpansion

for /f "delims=" %%b in ('type  C:\Windows\Inf\usbstor.inf1') do (

set "str=%%b"&set  "str=!str: 4= 3!"

echo !str!  >>C:\Windows\Inf\usbstor.inf

)

del C:\Windows\Inf\usbstor.inf1

 

C:只讀權限

 

啟動腳本:QD-R-usb.bat

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

reg add  "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\StorageDevicePolicies"  /v "WriteProtect" /t reg_dword /d "1" /f

ren C:\Windows\Inf\usbstor.inf  usbstor.inf1

@echo off&setlocal  EnableDelayedExpansion

for /f "delims=" %%b in ('type  C:\Windows\Inf\usbstor.inf1') do (

set "str=%%b"&set  "str=!str: 4= 3!"

echo !str!  >>C:\Windows\Inf\usbstor.inf

)

del C:\Windows\Inf\usbstor.inf1

 

以上,3條策略,分別下發三個OU進行獨立管控。

 

·


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM