用脚本让Windows关闭自动更新
时间: 2023-04-10 07:04:58 浏览: 321
可以使用以下脚本来关闭Windows自动更新:
1. 打开记事本,将以下代码复制并粘贴到记事本中:
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU]
"NoAutoUpdate"=dword:00000001
2. 将文件保存为“disable_update.reg”(注意文件扩展名必须是.reg)。
3. 双击该文件,点击“是”来确认,然后点击“确定”来关闭Windows自动更新。
请注意,关闭Windows自动更新可能会导致您的计算机安全性降低,因此请确保您定期手动更新Windows。
相关问题
关闭win10自动更新bat脚本
关闭Windows 10自动更新可以使用批处理脚本来实现。下面是一个示例的批处理脚本,可以帮助你关闭Windows 10的自动更新功能:
```
@echo off
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" /v NoAutoUpdate /t REG_DWORD /d 1 /f
net stop wuauserv
net stop bits
net stop dosvc
```
这个脚本通过修改注册表项和停止相关的服务来实现关闭自动更新。请注意,运行此脚本需要管理员权限。
如果你想重新启用自动更新,可以使用以下批处理脚本:
```
@echo off
reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" /v NoAutoUpdate /f
net start wuauserv
net start bits
net start dosvc
```
同样,运行此脚本也需要管理员权限。
请注意,关闭自动更新可能会导致系统安全性和稳定性方面的问题。建议在关闭自动更新之前仔细考虑,并确保定期手动更新系统以获取最新的安全补丁。
windows加固脚本_Linux主机自动加固脚本
对于 Windows 主机加固,可以使用以下脚本:
```
# 关闭不必要的服务
sc stop wuauserv
sc config wuauserv start=disabled
sc stop RemoteRegistry
sc config RemoteRegistry start=disabled
sc stop SSDPSRV
sc config SSDPSRV start=disabled
# 禁用不必要的端口
netsh advfirewall firewall add rule name="Block Port 135" dir=in action=block protocol=TCP localport=135
netsh advfirewall firewall add rule name="Block Port 137" dir=in action=block protocol=UDP localport=137
netsh advfirewall firewall add rule name="Block Port 138" dir=in action=block protocol=UDP localport=138
netsh advfirewall firewall add rule name="Block Port 139" dir=in action=block protocol=TCP localport=139
netsh advfirewall firewall add rule name="Block Port 445" dir=in action=block protocol=TCP localport=445
# 修改本地策略
secedit /export /cfg C:\secpol.cfg
(Get-Content C:\secpol.cfg).replace("PasswordComplexity = 1", "PasswordComplexity = 0") | Set-Content C:\secpol.cfg
secedit /configure /db %windir%\security\local.sdb /cfg C:\secpol.cfg /areas SECURITYPOLICY
# 禁止自动运行
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer" /v "NoAutoplayfornonVolume" /t REG_DWORD /d "1" /f
# 禁用 SMBv1
Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters" SMB1 -Type DWORD -Value 0 -Force
Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters" SMB1 -Type DWORD -Value 0 -Force
```
对于 Linux 主机加固,可以使用以下脚本:
```
# 更新系统
yum update -y
# 禁用不必要的服务
systemctl stop xinetd
systemctl disable xinetd
systemctl stop avahi-daemon.socket avahi-daemon.service
systemctl disable avahi-daemon.socket avahi-daemon.service
systemctl stop cups.socket cups.service
systemctl disable cups.socket cups.service
# 设置防火墙
firewall-cmd --zone=public --add-port=22/tcp --permanent
firewall-cmd --zone=public --add-port=80/tcp --permanent
firewall-cmd --zone=public --add-port=443/tcp --permanent
firewall-cmd --reload
# 修改SSH设置,禁用root登录
sed -i 's/#PermitRootLogin yes/PermitRootLogin no/g' /etc/ssh/sshd_config
systemctl restart sshd
# 安装 SELinux
yum install selinux-policy selinux-policy-targeted -y
```
以上脚本仅供参考,具体根据实际情况进行修改和调整。
相关推荐
![bat](https://img-home.csdnimg.cn/images/20210720083646.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)