3
My application needs to insert itself into the Windows Defender exclusions. Simply create a Myapp.exe key on the way
{HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows Defender\Exclusions\Processes}
, but it is by returning the message stating that I do not have permission.
I am machine administrator user and my application is running as administrator but the error is the same.
Windows 8.1 and 10 have their own command that can be run by Power Shell, but Windows 7 does not. They can help me?
Follow the code I’m using:
RegistryKey localRaiz;
RegistryKey key;
try
{
string path = @"SOFTWARE\Microsoft\Windows Defender\Exclusions\Processes";
localRaiz = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry64);
key = localRaiz.OpenSubKey(path);
key.SetValue("MPI.exe", 0, RegistryValueKind.DWord);
key.Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
had already tried this way. Thus the visual studio returns me the following error message: "Access to the requested Record is not allowed". Remembering that I am the machine administrator and my application runs as an administrator.
– Felipe Baeta