Reputation:
am new invb.net
programming, am developing an experimental application to block USB
ports in windows
computers,it can be possible by editing some values in regedit
as am new in programming i am totally blank, any help will much appreciated
Upvotes: 0
Views: 1689
Reputation: 21885
Imports Microsoft.Win32
Function to disable/Block
Private Sub functionToBlock()
Dim regKey As RegistryKey
regKey = Registry.LocalMachine.OpenSubKey("SYSTEM\CurrentControlSet\Services\USBSTOR", True)
regKey.SetValue("Start", 4) //' 4(To disable the ports)
End Sub
Function to Enable/Unblock
Private Sub functionToUnblock()
Dim regKey As RegistryKey
regKey = Registry.LocalMachine.OpenSubKey("SYSTEM\CurrentControlSet\Services\USBSTOR", True)
regKey.SetValue("Start", 3) //' 3(To enable the ports)
End Sub
Upvotes: 1
Reputation: 11104
below is the solution which is working for 32 bit windows but not working 64 bit ...
//disable USB storage...
Microsoft.Win32.Registry.SetValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\USBSTOR", "Start", 4, Microsoft.Win32.RegistryValueKind.DWord);
//enable USB storage...
Microsoft.Win32.Registry.SetValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\USBSTOR", "Start", 3, Microsoft.Win32.RegistryValueKind.DWord);
Upvotes: 0