A hacked-up-ghetto solution would be to write a script that would ping 8.8.8.8. If it found a reply then it knows that the usb port needs to be enabled. Have a custom ini file (or any kind of text file) to indicate it's current status. If the ping comes back successfully then check the ini file to see if the port is already enabled. If it is then do nothing. Otherwise run a enable_usb_port.reg script to enable the USB port by modifying the registry. If the ping comes back unsuccessful then you know that either your ping server (8.8.8.8) is down or you have no internet connection. If you find no internet connection then run the disable_usb_port.reg file and update the ini. If the ini already indicates that the port is disabled then do nothing. The enable_usb_port.reg
and disable_usb_port.reg
is just my naming convention and will need to be built based on the information below. Enable the USB port and then select to export the registry file for that line. Disable the USB port and then export the registry file for that line. This should give you the two ports. You can add a watchdog and/or create a service so that the script will run in the background regardless if the user is logged in or not.
As per the Microsoft knowledge base article 823732 which
contains instructions on how to disable USB storage access
for a certain group of users this disabling and re-enabing
of USB ports is based on a simple registry entry.
To disable the access to USB port, in windows XP and 2000:
Click Start, and then click Run.
In the Open box, type regedit, and then click OK.
Locate, and then click the following registry key:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\
Services\UsbStor
In the right pane, double-click Start.
In the Value data box, type 4, click Hexadecimal
(if it is not already selected), and then click OK.
- Quit Registry Editor.
To re-enable a disabled port:
Click Start, and then click Run.
In the Open box, type regedit, and then click OK.
Locate, and then click the following registry key:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\
Services\UsbStor
In the right pane, double-click Start.
In the Value data box, type 3, click Hexadecimal
(if it is not already selected), and then click OK.
- Quit Registry Editor.
However, there can be other ways too to bypass this issue,
one of the easiest is to invest in a PS2 to USB port convertor.