vb.netregistrydword

Registry DWord value changing in vb


I can't change the registry value in vb, please help.

Dim regKey As RegistryKey
        regKey=Registry.CurrentUser.OpenSubKey("Software\Microsoft\Windows\CurrentVersion\Policies\System", True)

regKey.SetValue("DisableTaskMgr", 1, RegistryValueKind.DWord)

regKey.Close()

Error

An unhandled exception of type 'System.Security.SecurityException' occurred in mscorlib.dll

Requested registry access is not allowed.


Solution

  • Execute your application with admins rights :

    Change <requestedExecutionLevel level="asInvoker" uiAccess="false" />

    to <requestedExecutionLevel level="requireAdministrator" uiAccess="false" />