【C#开源】Windows Defender开启关闭服务代码
当前位置:点晴教程→知识管理交流
→『 技术文档交流 』
using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Threading.Tasks;using System.Windows.Forms;using Microsoft.Win32;//BY-MCtechnamespace 关闭Windows_defender{ public partial class Form1 : Form { public Form1() { InitializeComponent(); RegistryKey key1 = Registry.LocalMachine; RegistryKey software1 = key1.OpenSubKey(@"SYSTEM\CurrentControlSet\Services\SecurityHealthService"); string GetValue1 = software1.GetValue("Start").ToString(); if(GetValue1 == "2") { label1.Text = "状态: 已开启!"; } else if (GetValue1 == "3") { label1.Text = "状态: 已被第三方软件接管!"; } else if (GetValue1 == "4") { label1.Text = "状态: 已关闭!"; } RegistryKey key2 = Registry.LocalMachine; RegistryKey software2 = key2.OpenSubKey(@"SYSTEM\CurrentControlSet\Services\wscsvc"); string GetValue2 = software2.GetValue("Start").ToString(); if (GetValue2 == "2") { label2.Text = "状态: 已开启!"; } else if (GetValue2 == "4") { label2.Text = "状态: 已关闭!"; } } private void Button1_Click(object sender, EventArgs e) { //开启安全健康服务 RegistryKey key1 = Registry.LocalMachine; RegistryKey software1 = key1.OpenSubKey(@"SYSTEM\CurrentControlSet\Services\SecurityHealthService", true); software1.SetValue("Start",2); string GetValue1 = software1.GetValue("Start").ToString(); if (GetValue1 == "2") { MessageBox.Show("开启成功!重启生效"); label1.Text = "状态: 已开启!"; } else { MessageBox.Show("错误!请以管理员权限运行若仍未解决我也没办法!"); } } private void Button2_Click(object sender, EventArgs e) { //关闭安全健康服务 RegistryKey key1 = Registry.LocalMachine; RegistryKey software1 = key1.OpenSubKey(@"SYSTEM\CurrentControlSet\Services\SecurityHealthService", true); software1.SetValue("Start", 4); string GetValue1 = software1.GetValue("Start").ToString(); if (GetValue1 == "4") { MessageBox.Show("关闭成功!重启生效"); label1.Text = "状态: 已关闭!"; } else { MessageBox.Show("错误!请以管理员权限运行若仍未解决我也没办法!"); } } private void Label1_Click(object sender, EventArgs e) { //安全健康服务状态 } private void Label2_Click(object sender, EventArgs e) { //安全中心服务状态 } private void Button4_Click(object sender, EventArgs e) { //关闭window Defender安全中心服务 RegistryKey key2 = Registry.LocalMachine; RegistryKey software2 = key2.OpenSubKey(@"SYSTEM\CurrentControlSet\Services\wscsvc", true); software2.SetValue("Start", 4); string GetValue2 = software2.GetValue("Start").ToString(); if (GetValue2 == "4") { MessageBox.Show("关闭成功!重启生效"); label2.Text = "状态: 已关闭!"; } else { MessageBox.Show("错误!请以管理员权限运行若仍未解决我也没办法!"); } } private void Button3_Click(object sender, EventArgs e) { //开启window Defender安全中心服务 RegistryKey key2 = Registry.LocalMachine; RegistryKey software2 = key2.OpenSubKey(@"SYSTEM\CurrentControlSet\Services\wscsvc", true); software2.SetValue("Start", 2); string GetValue2 = software2.GetValue("Start").ToString(); if (GetValue2 == "2") { MessageBox.Show("开启成功!重启生效"); label2.Text = "状态: 已开启!"; } else { MessageBox.Show("错误!请以管理员权限运行若仍未解决我也没办法!"); } } private void GroupBox1_Enter(object sender, EventArgs e) { } private void Form1_Load(object sender, 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 编辑过 |
关键字查询
相关文章
正在查询... |