Disabling Task manager using c# in OS Hardened machine
<p>I am using the below code to disable the task manager for a kiosk application which works perfectly </p>

<pre><code>    public void DisableTaskManager()
    {
        RegistryKey regkey;
        string keyValueInt = "1";
        string subKey = "Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\System";

        try
        {
            regkey = Registry.CurrentUser.CreateSubKey(subKey);
            regkey.SetValue("DisableTaskMgr", keyValueInt);
            regkey.Close();
        }
        catch (Exception ex)
        {
            MessageBox.Show("DisableTaskManager" + ex.ToString());
        }
    }
</code></pre>

<p>But when i run this in OS hardened machine i get the following error,</p>

<pre><code>DisableTaskManagerSystem.UnauthorizedAccessException: 
Access to the registry key 'HKey_Current_User\Software\Mictrosoft\Windows\CurrentVersion\Policies\System' is denied.
at Microsoft.win32.RegistryKey.win32Error(int32 errorcode, String str)
</code></pre>

<p>How can i overcome this ? I need to do this for a Kiosk application.</p>
