| 【C#开源】Windows Defender开启关闭服务代码
					当前位置:点晴教程→知识管理交流
					
					→『 技术文档交流 』
					
				 
 usingSystem;usingSystem.Collections.Generic;usingSystem.ComponentModel;usingSystem.Data;usingSystem.Drawing;usingSystem.Linq;usingSystem.Text;usingSystem.Threading.Tasks;usingSystem.Windows.Forms;usingMicrosoft.Win32;//BY-MCtechnamespace关闭Windows_defender{    publicpartialclassForm1 : Form    {        publicForm1()        {            InitializeComponent();            RegistryKey key1 = Registry.LocalMachine;            RegistryKey software1 = key1.OpenSubKey(@"SYSTEM\CurrentControlSet\Services\SecurityHealthService");             stringGetValue1 = software1.GetValue("Start").ToString();            if(GetValue1 == "2")            {                label1.Text = "状态: 已开启!";            }            elseif(GetValue1 == "3")            {                label1.Text = "状态: 已被第三方软件接管!";            }            elseif(GetValue1 == "4")            {                label1.Text = "状态: 已关闭!";            }            RegistryKey key2 = Registry.LocalMachine;            RegistryKey software2 = key2.OpenSubKey(@"SYSTEM\CurrentControlSet\Services\wscsvc");             stringGetValue2 = software2.GetValue("Start").ToString();            if(GetValue2 == "2")            {                label2.Text = "状态: 已开启!";            }            elseif(GetValue2 == "4")            {                label2.Text = "状态: 已关闭!";            }        }        privatevoidButton1_Click(objectsender, EventArgs e)        {            //开启安全健康服务            RegistryKey key1 = Registry.LocalMachine;            RegistryKey software1 = key1.OpenSubKey(@"SYSTEM\CurrentControlSet\Services\SecurityHealthService", true);            software1.SetValue("Start",2);            stringGetValue1 = software1.GetValue("Start").ToString();            if(GetValue1 == "2")            {                MessageBox.Show("开启成功!重启生效");                label1.Text = "状态: 已开启!";            }            else            {                MessageBox.Show("错误!请以管理员权限运行若仍未解决我也没办法!");            }        }        privatevoidButton2_Click(objectsender, EventArgs e)        {            //关闭安全健康服务            RegistryKey key1 = Registry.LocalMachine;            RegistryKey software1 = key1.OpenSubKey(@"SYSTEM\CurrentControlSet\Services\SecurityHealthService", true);            software1.SetValue("Start", 4);            stringGetValue1 = software1.GetValue("Start").ToString();            if(GetValue1 == "4") {                MessageBox.Show("关闭成功!重启生效");                label1.Text = "状态: 已关闭!";            }            else{ MessageBox.Show("错误!请以管理员权限运行若仍未解决我也没办法!"); }        }        privatevoidLabel1_Click(objectsender, EventArgs e)        {            //安全健康服务状态        }        privatevoidLabel2_Click(objectsender, EventArgs e)        {            //安全中心服务状态        }        privatevoidButton4_Click(objectsender, EventArgs e)        {            //关闭window Defender安全中心服务            RegistryKey key2 = Registry.LocalMachine;            RegistryKey software2 = key2.OpenSubKey(@"SYSTEM\CurrentControlSet\Services\wscsvc", true);            software2.SetValue("Start", 4);            stringGetValue2 = software2.GetValue("Start").ToString();            if(GetValue2 == "4") {                MessageBox.Show("关闭成功!重启生效");                label2.Text = "状态: 已关闭!";            }            else            {                MessageBox.Show("错误!请以管理员权限运行若仍未解决我也没办法!");            }        }        privatevoidButton3_Click(objectsender, EventArgs e)        {            //开启window Defender安全中心服务            RegistryKey key2 = Registry.LocalMachine;            RegistryKey software2 = key2.OpenSubKey(@"SYSTEM\CurrentControlSet\Services\wscsvc", true);            software2.SetValue("Start", 2);            stringGetValue2 = software2.GetValue("Start").ToString();            if(GetValue2 == "2")            {                MessageBox.Show("开启成功!重启生效");                label2.Text = "状态: 已开启!";            }            else            {                MessageBox.Show("错误!请以管理员权限运行若仍未解决我也没办法!");            }        }        privatevoidGroupBox1_Enter(objectsender, EventArgs e)        {        }        privatevoidForm1_Load(objectsender, EventArgs e)        {        }    }}请以管理员权限运行!请以管理员权限运行!请以管理员权限运行!重启生效, 运行环境:.NETFramework,Version=v4.6.1 成品地址:链接:https://pan.baidu.com/s/144qgh-hAILnSKCRZRmn28w 提取码:j5fd 复制这段内容后打开百度网盘手机App,操作更方便哦 文件名称:关闭Windows Defender MD5:c00f1da4d58d19e2dae064ef6a593b40 腾讯哈勃链接:https://habo.qq.com/file/showdetail?pk=ADcGZ11uB2UIMVs8U2c%3D 轻度风险 功能:开启关闭Windows Defender 健康中心,开启关闭Windows Defender安全中心服务 该文章在 2021/5/10 10:27:29 编辑过 | 关键字查询 相关文章 正在查询... |