[2005] Task Manager + Registry
I have a form, 2 buttons, i am able to disable task manager but it doesn't enable.
Button 1 Click.
Code:
Dim regkey As RegistryKey
regkey = Registry.CurrentUser.OpenSubKey("Software\Microsoft\Windows\CurrentVersion\Policies\System", True)
regkey.SetValue("DisableTaskMgr", "0")
Button 2 Click.
Code:
Dim regkey As RegistryKey
regkey = Registry.CurrentUser.OpenSubKey("Software\Microsoft\Windows\CurrentVersion\Policies\System", True)
regkey.SetValue("DisableTaskMgr", "1")
Am i doing something wrong?
Is there another way to change a value of the registry key?
Thanks
Edit: When i go into registry and try manual edit it to change the value to "0" so that it is enabled, it doesn't work.
The way i have enabled it is to go into gpedit.msc and do it from there, even though it is set to "not configured" in gpedit.
Hope that makes sense.
Re: [2005] Task Manager + Registry
The problem is that you use a string value when the value must be a Dword.
Code:
'Enable
Microsoft.Win32.Registry.SetValue _
("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\System", _
"DisableTaskMgr", 0, Microsoft.Win32.RegistryValueKind.DWord)
Code:
'Disable
Microsoft.Win32.Registry.SetValue _
("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\System", _
"DisableTaskMgr", 1, Microsoft.Win32.RegistryValueKind.DWord)
Re: [2005] Task Manager + Registry
Re: [2005] Task Manager + Registry
While this is fine as a learning exercise, this kind of code should not be used in a production application. Instead, you should have the network administrator set policies for personal computer usage, which can include not allowing access to Task Manager, and you should not give ordinary users local administrative rights on their computers.