Who to disable enable usb port while mouse keyboard not disable vb.net? I want to make an application which run on every computer and disable USB port? "But keyboard mouse not disable", application will be run by administrator with use of password no one will enable after that enable USB port.
"Also every time new usb device plug into computer software auto run and block it" Is there any possibility to do so?
Here i try below code and got error"{"Requested registry access is not allowed."}" in this line of code regKey = Registry.LocalMachine.OpenSubKey("SYSTEM\CurrentControlSet\Services\USBSTOR", True)
?
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
' Me.WebBrowser2.Document.InvokeScript("showJavascriptHelloWorld")
Dim regKey As RegistryKey
Dim ver As Decimal
'opens the path USBSTOR from regedit
If rtb.Checked Then
If MsgBox("All USB Ports Will Be Disabled Except The Presently Connected Ports (Ex.,USB Mouse,Printer etc !) ", MsgBoxStyle.OkCancel, "ARE YOU SURE ?!") = MsgBoxResult.Ok Then
regKey = Registry.LocalMachine.OpenSubKey("SYSTEM\CurrentControlSet\Services\USBSTOR", True)
regKey.SetValue("Start", 4) ' 4(To disable the ports)
End If
Else
regKey = Registry.LocalMachine.OpenSubKey("SYSTEM\CurrentControlSet\Services\USBSTOR", True)
regKey.SetValue("Start", 3) ' 3(To enable the ports)
MsgBox("Ports Are Enabled !", MsgBoxStyle.OkOnly)
End If
End Sub