• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 7574
  • Last Modified:

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
0
PipMic
Asked:
PipMic
1 Solution
 
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
 
PipMicAuthor Commented:
Hi,

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

Thanks
0
Has Powershell sent you back into the Stone Age?

If managing Active Directory using Windows Powershell® is making you feel like you stepped back in time, you are not alone.  For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why.

 
waleedaCommented:
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
 
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

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now