How disable and enable usb port via command prompt? or using batch script ? or using vb script in windows 7?
Enable or Disable Usb Ports Through Device ManagerRight-click on the “Start” button on the taskbar and select “Device Manager”. Expand USB Controllers. Right-click on all entries, one after another, and click “Disable Device”. Click “Yes” when you see a confirmation dialog.
You can also have a look at devcon
command. Available freely on microsoft site, for win7+ windows.
You can use batch which gives you a couple of options. You can edit the registry key to disable usb devices from being used
reg add HKLM\SYSTEM\CurrentControlSet\Services\UsbStor /v "Start" /t REG_DWORD /d "4" /f
To enable change value to 3
.
Or you can deny access to the files Usbstor.pnf
and Usbstor.inf
cacls %windir%\Inf\Usbstor.pnf /d user
cacls %windir%\Inf\Usbstor.inf /d user
Where user
is the user account that you want to deny access for.
To enable use
cacls %windir%\Inf\Usbstor.pnf /p user:R
cacls %windir%\Inf\Usbstor.inf /p user:R
Both commands will need admin rights.
Hope this helps
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With