I'm trying to a part in my program to enable CMD when it has been disabled.
The registry value is thus:

> Path "HKCU\Software\Policies\Microsoft\Windows\System"
> Key "Disable CMD"
> Value "0"

Every time I try to enable CMD with my program, I get an error message:

"Object reference not set to an instance of an object."

My code looks like this:

Private Sub Button1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        If ComboBox1.Text = "Command Prompt" Then
            Dim regKey As RegistryKey = Registry.CurrentUser.OpenSubKey("Software\Policies\Microsoft\Windows\System", True)
            regKey.SetValue("DisableCMD", 0)
        End If
End Sub

Can anybody help me?

Thank you in advance!

EDIT: Nevermind, I got it. Turns out the key didn't exist, causing the compiler to freak out. Sorry everyone. blush

Last edited by Slycer; 02/19/07 08:27 PM.

I don't hack. I simply test security, free of charge.