@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
|