TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Dave Murphy
NA
14
1.9k
How to gain access to a Registry Key and delete all subkeys
Aug 12 2018 1:08 PM
I need to gain access to this Registry key and delete all sub keys, but I keep getting a permission error
This is the actual Registry Key that I want to remove all the sub keys from:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkList\Profiles
This is the code that is throwing an error:
If I use this code, I get a permissions Error
RegistryKey aRegkey = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\NetworkList", true);
If I add the profiles Key, i Get a Null reference:
RegistryKey aRegkey = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\NetworkList\\Profiles", true);
I think I have to do something like this to get security permissions . . .
var security = aRegkey.GetAccessControl();
var rules = security.GetAccessRules(true, true, typeof(System.Security.Principal.NTAccount));
Any Help would be greatly appreciated :))
Reply
Answers (
3
)
real world examples with exolanation
Wpf reportviwer using xml as a l Datasource