batch files to enable and disable usb port and cd

Posted on 2011-03-04
Medium Priority
Last Modified: 2016-09-03

Would it be possible to write a MS Dos batch file to enable/disable the usb port and/or CD drive.

Question by:PipMic
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Expert Comment

ID: 35036524
MS DOS batch file, No... Your best approach to this would be to use WSH scripting to edit the local security policy settings do enable / disable access to the drives.


http://technet.microsoft.com/en-us/library/ee156602.aspx - editing the registry

I don't know the exact registry items to create / edit to enable / disable the drives...
LVL 25

Expert Comment

by:Lionel MM
ID: 35043444
You say you would to enable and disable a USB port--do you mean a USB drive or the USB port itself? Is the CD drive you want to enable/disable a removable drive or a fixed internal rive?

Author Comment

ID: 35045997

I meant disabling the use of a usb device. as regards the cd drive its a fixed internal drive.

WatchGuard's M Series Appliances - Miecom Approved

WatchGuard's newest M series appliances were put to the test by Miercom.  We had great results and outperformed all of our competitors in both stateless and stateful traffic throghput scenarios! Ready to see how your UTM appliance stacked up? Download the Miercom Report!


Accepted Solution

waleeda earned 375 total points
ID: 35153905
for disable use the below script and batch file

1st File: Disable USB.bat

@echo off
regedit /s 4.reg

subinacl.exe /keyreg \system\currentcontrolset\services\usbstor /deny=system
subinacl.exe /keyreg \system\currentcontrolset\services\usbstor /deny=Administrators

echo **USB drives disabled**


2nd File: 4.reg

Windows Registry Editor Version 5.00


make sure that you added "subinacl.exe" in the same folder while you are applying this script

Author Closing Comment

ID: 35301410
Would have preferred some explanantion, but i suppose i didnt ask for it!!

Expert Comment

by:bryan vanderveen
ID: 41783151
Lol that is really clear. When he says the steps, he starts out with what you need to name the files. You need to open a new text document for each one and past the script to the text document. After that click file and save as. Then use the title he gave u in the beginnings of the steps and select All Files then save. A file will appear, click on all the files u made.

Featured Post

Tutorial: Introduction to Managing a Linux Server

In this tutorial on systemd, we will explore:
-OS/Distro Adoption
-chkconfig and Other Legacy Commands
-Summary and Key Commands

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The Nano Server Image Builder helps you create a custom Nano Server image and bootable USB media with the aid of a graphical interface. Based on the inputs you provide, it generates images for deployment and creates reusable PowerShell scripts that …
A project that enables an administrator to perform actions within a user session context not just at the time of login but any time later on day(s) or week(s) later.
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question