Saturday, 15 March 2014

How to Unblock USB Ports-Through Regedit,Batch script & C

Usb_unblock.jpg
Sometime we want to copy data from our college’s computers…but when we plug in the USB drive, system didn’t show it off...actually at that time the USB ports are disabled by the college authority due to some reasons.Here Today I’m going explain you that how to disable/Enable USB ports.



 There are several methods to do it , so first we start from the Basic Method (i.e., Directly Edit the Registry) 

 Regedit Method

1. Open registry [Go to START MENU > RUN >Type regedit and hit Enter].

2. Navigate to
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\USBSTOR

Usb_unblock1.jpg
3. Now in right side pane Double click on REG_DWORD Start, A pop up window appears.

Usb_unblock2.jpg
Change its value to 4 for Disable the USB
Change its value to 3 for Enable the USB

Through Batch Script

1. Open Notepad [Press Windows_Key+R combination then type notepad and hit Enter] 

2. Copy/paste the following code to notepad
reg add HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\USBSTOR /v Start /t REG_DWORD /d 4 /f
3. Now save it as BlockUSB.bat.
4. Again open notepad and copy/paste the following code
reg add HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\USBSTOR /v Start /t REG_DWORD /d 3 /f
save it as UnblockUSB.bat

How to Use these Files
1. Open BlockUSB.bat with Administrator permissions to disable the USB drive.

2. Open UnblockUSB.bat file with Administrator permissions to enable the USB drive.

Through C Programming

"First of all I want to clear you that here we didn’t use something new...We just transform the above Batch Script Code into C source Code"

1. Open your C-compiler and copy/paste the below given Source Code.
#include<stdio.h> void main() { system("reg add HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\USBSTOR \/v Start \/t REG_DWORD \/d 4 \/f"); }

   Compile it and Save it As BlockUSB.c.
 2. Again open your C compiler and Copy/paste below given Source code.
#include<stdio.h>void main(){system("reg add HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\USBSTOR \/v Start \/t REG_DWORD \/d 3 \/f");}
 Compile it and save it as UnblockUSB.c.
3. Now you can use/execute/run BlockUSB.c to blocking the USB ports and UnblockUSB.c to Unblock.

 Please leave your Valuable Comments :)

14 comments:

  1. Amazing blog and very interesting stuff you got here! I definitely learned a lot from reading through some of your earlier posts as well and decided to drop a comment on this one!

    ReplyDelete
    Replies
    1. it's our pleasure that you like our articles,i just want to say that we need your support so keep supporting us .
      Have a Good Day..!

      Delete
  2. It ask for administrator password..is there another way to bypass it??

    ReplyDelete
    Replies
    1. OK.. i'll try to provide you the alternate solution to Unblock USB ports very soon..

      --Keep Visiting--

      Delete
  3. can we block only one port not all ports ?

    ReplyDelete
    Replies
    1. For blocking any other or all ports follow these steps:-

      1.Press Windows+R (or go to start menu then open Run),Type devmgmt.msc & hit enter. it will Open Device Manager.

      2.Now find & Expand "Universal Serial Bus Controllers"
      3.Right Click the USB port name to Disable or enable it.
      Done..!

      Delete
  4. Your all tricks are helpful to me thanks bro

    ReplyDelete
    Replies
    1. thanks for appreciating our work :)..

      keep visiting

      Delete
  5. thanks very useful

    ReplyDelete
  6. That is an extremely smartly written article. I will be sure to bookmark it and return to learn extra of your useful information. Thank you for the post. I will certainly return.

    ReplyDelete
  7. Hi, Really great effort. Everyone must read this article. Thanks for sharing.

    ReplyDelete