您现在的位置是:首页 > 电脑 > 

彻底禁用win10自动更新功能及其powershell代码

2025-07-26 00:16:29
以下禁用步骤实际上是微软提供的方法,可以禁用也可以恢复启用,健康无危害。 目前网络上常见的禁止更新方法有两种, 1、禁用Windows Update相关服务; 2、通过组策略禁止Windows Update更新。 事实证明这两种方法已经摆脱不了win10自动更新的魔爪,而且操作比较复杂对于小白同学很不友好。 同时也不

以下禁用步骤实际上是微软提供的方法,可以禁用也可以恢复启用,健康无危害。

目前网络上常见的禁止更新方法有两种,

1、禁用Windows Update相关服务;

2、通过组策略禁止Windows Update更新。

事实证明这两种方法已经摆脱不了win10自动更新的魔爪,而且操作比较复杂对于小白同学很不友好。

同时也不建议像网上那些文章介绍的去删除更新服务或者大量写注册表,以下亲测有效:

一,禁用windows Update的更新,参考步骤如下:

1.     在windows logo右键输入:打开本地组策略

2,路径:计算机配置-管理模板-Windows组件-Windows 更新

策略名称:指定internal Microsoft更新服务日志

设置 :Enabled (只需要配置错误的URL,例如“ ..”)

,路径:计算机配置-管理模板-Windows组件-Windows 更新

策略名称:删除使用所有 Windows 更新功能的访问权限

设置: Enabled

4,路径:计算机配置-管理模板-Windows组件-Windows 更新

策略名称:配置自动更新

设置: Disable

5,路径:计算机配置-管理模板-Windows组件-Windows 更新

策略名称:不允许更新延迟策略对 Windows 更新执行扫描

设置: Enabled

6,路径:计算机配置-管理模板-系统

策略名称:指定可选组件安装和组件修复的设置

设置: Enabled

7,设置完成过后,以管理员权限打开CMD.,执行gpupdate /force 命令。

二,将上面的操作利用powershell化,代码如下:

我将其写成了powershell函数,

#系统自动更新禁用
Function DisableWindowsUpdate {
	Write-Output start to disable windows update
	Stop-Service -ame Windows Update
	#net stop wuauserv
	#sc config wuauserv start=disable
	#net stop trustedinstaller
	#sc config trustedinstaller start=disable
	#组策略1:启用指定internal Microsoft更新服务位置
	If (!(Test-Path HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU)) {
		ew-Item -Path HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU -Force | Out-ull
	}
	Set-ItemProperty -Path HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU -ame UseWUServer -Type DWord -Value 1
	#组策略2:禁用配置自动更新
	Set-ItemProperty -Path HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU -ame oAutoUpdate -Type DWord -Value 1
	#组策略:删除使用所有 Windows 更新功能的访问权限
	Set-ItemProperty -Path HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU -ame SetDisableUXWUAccess -Type DWord -Value 1
	
	#组策略1:故意执行错误配置
	If (!(Test-Path HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate)) {
		ew-Item -Path HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate -Force | Out-ull
	}
	Set-ItemProperty -Path HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate -ame WUServer -Type String -Value ...
	Set-ItemProperty -Path HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate -ame WUStatusServer -Type String -Value ...
	#组策略4:不允许更新延迟策略对 Windows 更新执行扫描
	Set-ItemProperty -Path HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate -ame DisableDualScan -Type DWord -Value 1
	#组策略5:策略名称:指定可选组件安装和组件修复的设置
	If (!(Test-Path HKLM:\Software\Microsoft\Windows\CurrentVersion\Policies\Servicing)) {
		ew-Item -Path HKLM:\Software\Microsoft\Windows\CurrentVersion\Policies\Servicing -Force | Out-ull
	}
	Set-ItemProperty -Path HKLM:\Software\Microsoft\Windows\CurrentVersion\Policies\Servicing -ame RepairContentServerSource -Type DWord -Value 2
	Set-ItemProperty -Path HKLM:\Software\Microsoft\Windows\CurrentVersion\Policies\Servicing -ame UseWindowsUpdate -Type DWord -Value 2
	Write-Output disable windows update successful
}
#系统自动更新禁用的反向操作
Function EnableWindowsUpdate {
	Write-Output start to enable windows update
	Start-Service -ame Windows Update
	#组策略1:禁用指定internal Microsoft更新服务位置
	If (!(Test-Path HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU)) {
		ew-Item -Path HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU -Force | Out-ull
	}
	Set-ItemProperty -Path HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU -ame UseWUServer -Type DWord -Value 0
	#组策略2:启动配置自动更新
	Set-ItemProperty -Path HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU -ame oAutoUpdate -Type DWord -Value 0
	#组策略:不删除使用所有 Windows 更新功能的访问权限
	Set-ItemProperty -Path HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU -ame SetDisableUXWUAccess -Type DWord -Value 0
	
	#组策略1:恢复错误配置
	If (!(Test-Path HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate)) {
		ew-Item -Path HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate -Force | Out-ull
	}
	Set-ItemProperty -Path HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate -ame WUServer -Type String -Value 
	Set-ItemProperty -Path HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate -ame WUStatusServer -Type String -Value 
	#组策略4:允许更新延迟策略对 Windows 更新执行扫描
	Set-ItemProperty -Path HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate -ame DisableDualScan -Type DWord -Value 0
	#组策略5:策略名称:指定可选组件安装和组件修复的设置
	If (!(Test-Path HKLM:\Software\Microsoft\Windows\CurrentVersion\Policies\Servicing)) {
		ew-Item -Path HKLM:\Software\Microsoft\Windows\CurrentVersion\Policies\Servicing -Force | Out-ull
	}
	Remove-ItemProperty -Path HKLM:\Software\Microsoft\Windows\CurrentVersion\Policies\Servicing -ame RepairContentServerSource
	Remove-ItemProperty -Path HKLM:\Software\Microsoft\Windows\CurrentVersion\Policies\Servicing -ame UseWindowsUpdate
	Write-Output enable windows update successful
}

三,将脚本制作成工具

注意:不要在正在下载补丁或者已经安装完补丁等待重启时执行禁用,如果已安装补丁,则更新完系统重启一次后再禁用

禁用后表现为如下现象,将永远无法到补丁源: 

四,启用自动更新

如果你需要重新开启自动更新功能,可以使用该voitools工具解除禁用

 解除禁用后重启即可恢复下载补丁

五,工具的下载链接和源代码如下:

阿里云盘链接:https://www.aliyundrive/s/fTSZMmQc4WM

百度网盘链接:https://pan.baidu/s/1QnoYc4BKsLswKhbij_Do8g 。提取码:r8lv 

#感谢您对电脑配置推荐网 - 最新i3 i5 i7组装电脑配置单推荐报价格的认可,转载请说明来源于"电脑配置推荐网 - 最新i3 i5 i7组装电脑配置单推荐报价格

本文地址:http://www.dnpztj.cn/diannao/370765.html

相关标签:无
上传时间: 2023-06-02 01:53:30
留言与评论(共有 12 条评论)
本站网友 郭子威
5分钟前 发表
\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU)) { ew-Item -Path HKLM
本站网友 高手进阶区
5分钟前 发表
\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU -ame oAutoUpdate -Type DWord -Value 1 #组策略:删除使用所有 Windows 更新功能的访问权限 Set-ItemProperty -Path HKLM
本站网友 农业技术网
15分钟前 发表
\Software\Microsoft\Windows\CurrentVersion\Policies\Servicing -Force | Out-ull } Remove-ItemProperty -Path HKLM
本站网友 郑萍
25分钟前 发表
禁用后表现为如下现象,将永远无法到补丁源:  四,启用自动更新 如果你需要重新开启自动更新功能,可以使用该voitools工具解除禁用  解除禁用后重启即可恢复下载补丁 五,工具的下载链接和源代码如下: 阿里云盘链接:https
本站网友 江西外语外贸学院
28分钟前 发表
事实证明这两种方法已经摆脱不了win10自动更新的魔爪,而且操作比较复杂对于小白同学很不友好
本站网友 双眼皮全过程
20分钟前 发表
执行gpupdate /force 命令
本站网友 肺癌新药
20分钟前 发表
\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate -ame DisableDualScan -Type DWord -Value 0 #组策略5:策略名称:指定可选组件安装和组件修复的设置 If (!(Test-Path HKLM
本站网友 非梦卡盟刷钻
3分钟前 发表
\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU -ame SetDisableUXWUAccess -Type DWord -Value 1 #组策略1:故意执行错误配置 If (!(Test-Path HKLM
本站网友 上海养老金上调
25分钟前 发表
\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate -ame WUServer -Type String -Value  Set-ItemProperty -Path HKLM
本站网友 梁亮胜
14分钟前 发表
//www.aliyundrive/s/fTSZMmQc4WM 百度网盘链接:https
本站网友 上海电气液压气动有限公司
8分钟前 发表
通过组策略禁止Windows Update更新