We're a community of 1077K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,076,220 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

Disable USB in win 7

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

2
Contributors
2
Replies
1 Day
Discussion Span
9 Months Ago
Last Updated
3
Views
Question
Answered
M.Waqas Aslam
Master Poster
745 posts since Aug 2011
Reputation Points: 50
Solved Threads: 120
Skill Endorsements: 2

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)
Reverend Jim
Carpe per diem
Moderator
3,600 posts since Aug 2010
Reputation Points: 561
Solved Threads: 447
Skill Endorsements: 32

thanks jim , my prob is solved .

Regards

M.Waqas Aslam
Master Poster
745 posts since Aug 2011
Reputation Points: 50
Solved Threads: 120
Skill Endorsements: 2
Question Answered as of 9 Months Ago by Reverend Jim

This question has already been solved: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
View similar articles that have also been tagged:
 
© 2013 DaniWeb® LLC
Page rendered in 0.0645 seconds using 2.64MB