Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27209

Disable task manger code didn't quite work

$
0
0
I got this code to disable and enable the task manager off of Google. The code disabled the task manager and when I tried to access it I got a message saying the task manager is disbaled by an administrator. When I ran the piece to enable it I could see in the register where it was set to zero but I still got the message and couldn't bring up the task manager. Restarting the computer didn't help. On Google I found this command and ran it from the start menu and it restored my access:

REG add HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\System /v DisableTaskMgr /t REG_DWORD /d 0 /f

I got it from here:

http://social.technet.microsoft.com/...tor-error-help

So my question is can anyone see what in this code to enable might not work? One possibility is I did this at work and maybe group policies kept it from working somehow even though in regedit I could see it set to zero.

Code:

Imports Microsoft.Win32

Public Class Form1

    Private Sub btnDisable_Click(sender As Object, e As EventArgs) Handles btnDisable.Click
        Dim regkey As RegistryKey
        Dim keyValueInt As String = "1"
        Dim subKey As String = "Software\Microsoft\Windows\CurrentVersion\Policies\System"
        Try
            regkey = Registry.CurrentUser.CreateSubKey(subKey)
            regkey.SetValue("DisableTaskMgr", keyValueInt)
            regkey.Close()
        Catch ex As Exception
            MsgBox(ex.Message, MsgBoxStyle.Critical, "Registry Error!")
        End Try

    End Sub

    Private Sub btnEnable_Click(sender As Object, e As EventArgs) Handles btnEnable.Click
        Dim regkey As RegistryKey
        Dim keyValueInt As String = "0"    '0x00000000 (0)
        Dim subKey As String = "Software\Microsoft\Windows\CurrentVersion\Policies\System"
        Try
            regkey = Registry.CurrentUser.CreateSubKey(subKey)
            regkey.SetValue("DisableTaskMgr", keyValueInt)
            regkey.Close()
        Catch ex As Exception
            MsgBox(ex.Message, MsgBoxStyle.Critical, "Registry Error!")
        End Try

    End Sub
    'This fixed it
    ' REG add HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\System /v DisableTaskMgr /t REG_DWORD /d 0 /f
    'got it from here
    'http://social.technet.microsoft.com/Forums/windows/en-US/bd8f2782-110f-459c-9aaf-54e561bf587d/task-manager-has-been-disabled-by-your-administrator-error-help

End Class


Viewing all articles
Browse latest Browse all 27209

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>