用powershell|用powershell 批量卸载 windows 更新
$KBID = "KB958488" $KBID1 = "KB976902" 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|用powershell 批量卸载 windows 更新】
推荐阅读
- Docker应用:容器间通信与Mariadb数据库主从复制
- JS中的各种宽高度定义及其应用
- 由浅入深理解AOP
- 【译】20个更有效地使用谷歌搜索的技巧
- 涉毒患者(新诗)
- 参保人员因患病来不及到指定的医疗机构就医,能否报销医疗费用()
- mybatisplus如何在xml的连表查询中使用queryWrapper
- MybatisPlus|MybatisPlus LambdaQueryWrapper使用int默认值的坑及解决
- MybatisPlus使用queryWrapper如何实现复杂查询
- 标签、语法规范、内联框架、超链接、CSS的编写位置、CSS语法、开发工具、块和内联、常用选择器、后代元素选择器、伪类、伪元素。