How to Block your Computer’s USB Ports

Are you tired of virus attacks in your computer lab? Here is a simple trick to block your computers' USB ports and work in peace.

In my work as a computer repair technician, I have been privileged to support many schools in servicing their computer labs. In almost of these school visits, I have found a common problem – viruses! In fact, when we asked fellow teachers of ICT which topics we would share about in our #EachOneTeachOne series, we got several requests asking how they would deal with viruses.

So, in one of our zoom sessions, I hosted George William Kasaazi who took us through a whole hour explaining to us what viruses are, how they infect us and how to deal with them. (You can watch the lesson in the video below)

George William Kasaazi was our host as he guided us on how to deal with viruses.

During the session, teachers were advised to either use the existing Windows Defender, Microsoft’s Malware Removal Tool or purchase a genuine antivirus license.

Despite all the above solutions, computers will still be prone to virus attacks. In my experience working with computers, I have discovered that most viruses (in a school scenario) are transmitted through USB ports. Students and any other user of computer labs will bring in flash disks or external drives from unknown sources. The chances of bringing in an infected device are certainly high.

You may not always be available to monitor who brings in what. You may not even be in position to scan every device that comes in but most annoyingly, viruses keep evolving. You may not be in position to keep up with the pace. So what other option do you have? – Block USB ports!

How to block a computer’s USB ports

Step 1: Copy the code below and paste it in notepad

reg add HKLM\SYSTEM\CurrentControlSet\Services\UsbStor /v "Start" /t REG_DWORD /d "4" /f

Step 2: Save the file as a batch file i.e. filename.bat

This will create a batch file that you run as administrator to block all USB ports on your PC. From now on, anyone who plugs in their USB device will not be able to access it. This will bring relief as you will avoid any viruses that come with USB devices.

How to unblock a computer’s USB ports

As a matter of fact, it can be inconveniencing when you cannot use your computer’s USB ports. The ports and devices are an easy way to transfer files from one computer to another. This means that in one or another, you will always need them.

In order to unblock the USB ports, you will use the same code but with just one adjustment. You will have to replace the 4 with a 3 just like below.

reg add HKLM\SYSTEM\CurrentControlSet\Services\UsbStor /v "Start" /t REG_DWORD /d "3" /f

Paste the code above in a notepad file and save as a batch file (with extension .bat) e.g unblock.bat

When you run this batch file as administrator, you will be able to use the USB ports. It is however advisable that you use only a trusted device and always block the ports again after use.

In this way, you will have saved yourself a lot of inconveniences caused by viruses in your school lab.

Do you have issues with your computer lab that you wish to solve? Visit my website or click here to see direct some of the schools whose computer labs I have worked on.

__________________________________________________
Stephen Dumba is the National Coordinator of the ICT Teachers’ Association of Uganda. Besides teaching ICT, he repairs computers and builds websites. Steve is a speaker and facilitator at tech events and and CEO of senior1.org and a consultant on education technology.

Tel: +256 772 111 223 | +256 752 111 223 | Email: stephen.dumba@gmail.com
__________________________________________________