批处理批量卸载微软补丁

这段代码展示了如何使用wusa.exe命令行工具在Windows中批量卸载特定的更新补丁,如KB5005569, KB5005573等。通过/wusa/uninstall/kb参数指定KB号,可以实现静默卸载。注意,/quiet参数用于无用户交互模式,而/norestart则可防止自动重启。在某些情况下,可能需要手动重启操作系统以完成卸载过程。
摘要由CSDN通过智能技术生成
@echo off
@wusa /uninstall /kb:5005569 
@wusa /uninstall /kb:5005573 
@wusa /uninstall /kb:5005568 
@wusa /uninstall /kb:5005566 
@wusa /uninstall /kb:5005565
@echo off
rem utf-8
chcp 65001
@echo 卸载完成
@pause

这段代码的核心是wusa命令,Windows Update Standalone Installer,专门用来管理升级包的。

参考:

WUSA.exe
Windows Update Standalone Installer.

Syntax
      WUSA options

Options:
   /extract    Extract the package contents to a destination folder.
               This option was removed from Windows 10 due to a security issue, privilege elevation
               would allow executables to be extracted to C:\windows\system32 [x].

   /kb:#####   Uninstall a package led by using its KB number. Use only together with /uninstall.

   /quiet      Run Wusa.exe in quiet mode without user interaction. When the tool runs in quiet mode,
               it runs without user interaction. The computer restarts if this is required.

               For example, if the Windows6.0-KB934307-x86.msu file is in the D:\934307 folder,
               type the following command at a command prompt to install the update package without
               user interaction:

               wusa.exe d:\934307\Windows6.0-KB934307-x86.msu /quiet

               When you use this switch, the Microsoft Software License Terms do not appear.

   /norestart  Prevent Wusa.exe from restarting the computer.
               The /norestart switch is ignored if the /quiet switch is not present.
               If you run Wusa.exe together with these two switches, you must manually restart the
               operating system after the installation is complete (if the installation requires a restart)

               For example, if the Windows6.0-KB934307-x86.msu file is in the D:\934307 folder, type
               the following command to install the update package:

               wusa.exe D:\934307\Windows6.0-KB934307-x86.msu /quiet /norestart

   /warnrestart
               When this switch is combined with the /quiet switch, Wusa.exe prompts you before it
               begins a restart for install and uninstall operations.

   /forcerestart
               When this switch is combined with the /quiet switch, Wusa.exe forcibly closes
               applications and then begins a restart.

   /uninstall /kb:#####
               Uninstall an update.

   /?, /h, /help   View help.
The wusa usage to quietly uninstall an update has been deprecated. (wusa.exe /uninstall /kb:####### /quiet )
The uninstall command with /quiet switch fails with event ID 8 in the Setup event log. Uninstalling updates quietly could be a security risk because malicious software could quietly uninstall an update in the background without user intervention.

On sites where WSUS is enabled, you may sometimes need to temporarily revert to Windows Update (0) in place of the WSUS server (1).

HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU

Value name: UseWUServer
value = 0 to use a Windows Update server.
value = 1 to use a local server that is running Software Update Services.

Restart the Windows Update Service to ensure the changes take effect:

NET stop wuauserv
NET start wuauserv

Examples:

C:\> WUSA d:\934307\Windows6.0-KB934307-x86.msu /quiet

C:\> WUSA D:\934307\Windows6.0-KB934307-x86.msu /quiet /norestart

C:\> WUSA /uninstall /kb:934307 /norestart

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

G00dChina

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值