hello !
i want to disable my usb port using c# or vb.net ,is it possible to do so using .net ? if yes then any idea how i can do this ?

Regards

The following gets a value from the registry. Normally it is set to 3. If you set it to 4 then USB access will be denied. However, setting the value requires admin access.

My.Computer.Registry.GetValue("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\USBSTOR\","Start",0)

To set a new value use

My.Computer.Registry.SetValue("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\USBSTOR\","Start",4,Microsoft.Win32.RegistryValueKind.DWord)

thanks jim , my prob is solved .

Regards

It is showing unauthorizedaccessexception, pls help, in win7

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.