I am creating a software which is detecting threats on system but it requires Microsoft Security Essentials to clean that system. So I want to know whether Microsoft Security Essentials is running on the system so I can use this utility to make my software work. I already got this solution to check whether Microsoft Security Essentials is installed but I need to know to whether it is running or not? Thank you in advance.
To Check Microsoft security essential I have implemented the following code
private static bool DoesMseExist()
{
string location = @"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall";
using (RegistryKey localMachineX64View =
RegistryKey.OpenBaseKey(RegistryHive.LocalMachine,
RegistryView.Registry64))
{
using (RegistryKey rk = localMachineX64View.OpenSubKey(location))
{
foreach (string subKey in rk.GetSubKeyNames())
{
using (RegistryKey productKey = rk.OpenSubKey(subKey))
{
if (productKey != null)
{
if (Convert.ToString(productKey.GetValue("DisplayName"))
.Contains("Microsoft Security Client"))
{
return true;
}
}
}
}
}
}
return false;
}