Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Changing permissions on a registry key...

Status
Not open for further replies.

Soulbait

MIS
Mar 12, 2003
43
US
So I've got this little issue...

I need to delete a key under Enum...you may be asking why...Don't.

But

RegKey = My.Computer.Registry.LocalMachine.OpenSubKey("SYSTEM", _
True).OpenSubKey("CurrentControlSet", _
True)

Try
rs.AddAccessRule(New RegistryAccessRule(user, _
RegistryRights.FullControl, _
AccessControlType.Allow))
RK2 = RegKey.OpenSubKey("Enum", True)
RK2.SetAccessControl(rs)
Catch ex As UnauthorizedAccessException
Console.WriteLine(vbCrLf & "didn't work...", ex.Message)
End Try

Doesn't seem to put the appropriate permissions onto the key

With the True for OpenSubKey it says can't open subkey, if I switch that to false it doesn't even try to work.

I know my syntax is working due to the fact of changing it to another key I can change the permissions.

Also I can change the permissions of the Enum key manually through regedit.

So basically it looks like I need to open the key to put on the permissions but I can't open the key until I put the permissions on it...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top