batch files to enable and disable usb port and cd

Hiya,

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

Thanks
PipMicAsked:
Who is Participating?
 
waleedaConnect With a Mentor Commented:
for disable use the below script and batch file

1st File: Disable USB.bat

@echo off
cls
regedit /s 4.reg



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

cls
echo.
echo **USB drives disabled**

echo.

2nd File: 4.reg

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\USBSTOR]
"Start"=dword:00000004

make sure that you added "subinacl.exe" in the same folder while you are applying this script
0
 
richardburwoodCommented:
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.

See:

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...
0
 
Lionel MMSmall Business IT ConsultantCommented:
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?
0
Protect Your Employees from Wi-Fi Threats

As Wi-Fi growth and popularity continues to climb, not everyone understands the risks that come with connecting to public Wi-Fi or even offering Wi-Fi to employees, visitors and guests. Download the resource kit to make sure your safe wherever business takes you!

 
PipMicAuthor Commented:
Hi,

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

Thanks
0
 
PipMicAuthor Commented:
Would have preferred some explanantion, but i suppose i didnt ask for it!!
0
 
bryan vanderveenCommented:
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.
1
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.