I want to disable/enable all usb ports at once.
I tried the following:
Changed the registry (with admin privileges):
//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);
I also tried Hardware Helper Library for C# - even not detecting the devices
and Win32 API function to programmatically enable/disable device
I am using windows 8.1 64bit if it matters, and I compile the code with platform target = any CPU if it matters again.
EDIT:
Still not working.
I want to block/disable all the usb devices then even connect in the future and not only the current.
Can anyone help me?
Would appreciate your help.