用powershell 卸载所有 windows 更新
2017-02-08 14:49
411 查看
用powershell 卸载所有 windows 更新,删除所有更新哦谨慎使用。
这里是参考地址:https://gallery.technet.microsoft.com/scriptcenter/Uninstall-security-update-76f2dcb7$KBID = "kb3054862" cls function Remove-Update { $HotFixes = Get-HotFix [int]$count = 0; foreach ($HotFix in $HotFixes) { $count = $count + 1 Write-Host $count / $HotFixes.Count if (($KBID -ne $HotFix.HotfixId) -and ($KBID1 -ne $HotFix.HotfixId)) { "Inside first if" $KBID = $HotFix.HotfixId.Replace("KB", "") $RemovalCommand = "wusa.exe /uninstall /kb:$KBID /quiet /norestart" Write-Host "Removing $KBID from the target." Invoke-Expression $RemovalCommand } if ($KBID -match "All") { $KBNumber = $HotFix.HotfixId.Replace("KB", "") $RemovalCommand = "wusa.exe /uninstall /kb:$KBNumber /quiet /norestart" Write-Host "Removing update $KBNumber from the target." Invoke-Expression $RemovalCommand } if ($KBID -match "Security") { if ($HotFix.Description -match "Security") { $KBSecurity = $HotFix.HotfixId.Replace("KB", "") $RemovalCommand = "wusa.exe /uninstall /kb:$KBSecurity /quiet /norestart" Write-Host "Removing Security Update $KBSecurity from the target." Invoke-Expression $RemovalCommand } } while (@(Get-Process wusa -ErrorAction SilentlyContinue).Count -ne 0) { Start-Sleep 3 Write-Host "Waiting for update removal to finish ..." } } } Remove-Update
相关文章推荐
- 用powershell 批量卸载 windows 更新
- 一段自动搜索所有SVN工作目录进行更新的PowerShell脚本
- [4月10日的脚本] 更新Windows 8 (PowerShell)
- Windows 更新和更新卸载
- windows下 python 子模块管理(安装,更新,卸载)
- 微软Windows卸载工具--可解决更新Silverlight不能成功安装问题
- 解决Windows 7下IE11无法卸载、无法重新安装,提示安装了更新的IE版本
- 解决Windows 7下IE11无法卸载、无法重新安装,提示安装了更新的IE版本
- caffe小问题汇总(持续更新) PS:所有问题均在caffe-windows下产生 1、为什么AlexNet中,InnerProduct_Layer(fc8)层的输出可以直接作为Accuracy
- 自动搜索所有SVN工作目录进行更新的PowerShell脚本
- 通过PowerShell卸载所有的SharePoint 2010 解决方案
- 解决Windows 7下IE11无法卸载、无法重新安装,提示安装了更新的IE版本
- 使用 Azure PowerShell 监视和更新 Windows 虚拟机
- 通过PowerShell卸载所有的SharePoint 2010 解决方案
- Windows 10 创意者更新-1703所有版本汇总
- 解决:Windows自动更新所有选框都是灰色的方法
- 使用 Azure PowerShell 监视和更新 Windows 虚拟机
- win7怎样重新安装卸载之后的Windows系统更新与补丁?
- asp.net 中一次性更新DATAGRID中所有记录
- 如何在Windows 2000下将Oracle完全卸载