LOGO OA教程 ERP教程 模切知识交流 PMS教程 CRM教程 开发文档 其他文档  
 
网站管理员

【C#开源】Windows Defender开启关闭服务代码

admin
2021年5月10日 10:27 本文热度 3849
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-MCtech
 
 
 
namespace 关闭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 编辑过
关键字查询
相关文章
正在查询...
点晴ERP是一款针对中小制造业的专业生产管理软件系统,系统成熟度和易用性得到了国内大量中小企业的青睐。
点晴PMS码头管理系统主要针对港口码头集装箱与散货日常运作、调度、堆场、车队、财务费用、相关报表等业务管理,结合码头的业务特点,围绕调度、堆场作业而开发的。集技术的先进性、管理的有效性于一体,是物流码头及其他港口类企业的高效ERP管理信息系统。
点晴WMS仓储管理系统提供了货物产品管理,销售管理,采购管理,仓储管理,仓库管理,保质期管理,货位管理,库位管理,生产管理,WMS管理系统,标签打印,条形码,二维码管理,批号管理软件。
点晴免费OA是一款软件和通用服务都免费,不限功能、不限时间、不限用户的免费OA协同办公管理系统。
Copyright 2010-2024 ClickSun All Rights Reserved