用powershell 批量卸载 windows 更新
- $KBID = "KB958488"
- $KBID1 = "KB976902"
- cls
- function Remove-Update {
- $HotFixes = Get-HotFix
- [int]$count = ;
- foreach ($HotFix in $HotFixes)
- {
- $count = $count +
- 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 )
- {
- Start-Sleep
- Write-Host "Waiting for update removal to finish ..."
- }
- }
- }
- Remove-Update
用powershell 批量卸载 windows 更新的更多相关文章
- 赫然:Windows Live Writer 批量博客更新软件使用教程
http://www.wocaoseo.com/thread-144-1-1.html 推广人员需要使用多个博客,一个一个登陆更新是很麻烦的事情,网上的桌面批量更新博客软件也不少,今天在此推荐大家使用 ...
- 安装sqlserver 的时候 报错:无法通过Windows功能控制面板自动安装或卸载Windows Server 角色和功能。
无法安装以下功能:.NET Framework 3.5(包括.NET2.0和3.0) 无法通过Windows功能控制面板自动安装或卸载Windows Server 角色和功能. 若要安装Windows ...
- Ansible 批量管理Windows Server服务器
Ansible批量管理Windows Server Ansible是一款为类Unix系统开发的自由开源的配置和自动化工具, 它用Python写成,类似于saltstack和Puppe ...
- powershell脚本之windows服务与进程
powershell脚本之windows服务与进程 服务与进程的区别: Windows服务是指系统自动完成的,不需要和用户交互的过程,可长时间运行的可执行应用程序 进程是程序运行的实例,系统会给运行中 ...
- Windows更新导致的打印问题
最近很多BarTender用户都出现了打印问题,如3700错误消息及3721错误消息.这个问题存在于BarTender的所有版本,这主要是因为什么?又该如何去解决呢? 根据BarTender英文官网提 ...
- 无限重启:windows更新之后,在输入密码页面无限重启进入不了系统
解决办法:windows更新之后,在输入密码页面无限重启 总体思路:进入安全模式(如何进入,下文将讲述) --> 点击疑难解答 --> 点击高级选项 --> 点击启 ...
- 卸载windows安装ubuntu的完全指南
卸载windows安装ubuntu的完全指南 新配置了一台深度学习服务器,但是预装系统为windows10,与需求不符.于是,自己动手安装ubuntu(18.04).此文为过程记录. 主要步骤: 准备 ...
- Windows更新清理工具 (winsxs 清理工具)
Windows 更新清理工具是一款效果非常显著的Windows7.Windows8操作系统清理优化工具!经常安装系统的朋友相比有所体会,刚刚安装完成的Win7.Win8其实占的空间并不大,去掉页面文件 ...
- 使用powershell批量添加Qt的文件(生成pro)
想使用QtCreator作为编辑器编辑keil或者IAR的工程,需要生成.pro文件,于是使用powershell批量处理. 源码如下: $incPath = dir -filter "*. ...
随机推荐
- 【转】单KEY业务,数据库水平切分架构实践
本文将以“用户中心”为例,介绍“单KEY”类业务,随着数据量的逐步增大,数据库性能显著降低,数据库水平切分相关的架构实践: 如何来实施水平切分 水平切分后常见的问题 典型问题的优化思路及实践 一.用户 ...
- 将当前的Ubuntu系统封装成为可以安装(发布)的iso镜像
将当前的Ubuntu系统封装成为可以安装(发布)的iso镜像 在使用以上方法安装依赖的时候xresprobe 会找不到安装地址,采用下面的方式: Package xresprobe is not in ...
- Jmeter(三十四)_Beanshell解析并提取json响应
1:前置条件 将fastjson-1.2.49.jar包置于jmeter的lib目录下,并将该jar包添加到测试计划的Library中:否则会报:Typed variable declaration ...
- CSS编码规则
/* 和HTML一样使用两个空格来代替制表符 */ div { /* 为了代码的易读性,在每个声明块的左花括号前添加一个空格 */' padding: 15px; /* 每个声明语句的:后应该插入一个 ...
- MyBatis 返回类型resultType为map时的null值不返回问题
问题一: 查询结果集中 某字段 的值为null,在map中不包含该字段的key-value对 解决:在mybatis.xml中添加setting参数 <!-- 在null时也调用 sett ...
- Centos wget命令 not found解决方法
如果已经有了yun源,则可通过yun源命令来安装wget. 如下所示: 2.yum安装yum -y install wget 即可安装:
- 基于SSH实现员工管理系统之框架整合篇
本篇文章来源于:https://blog.csdn.net/zhang_ling_yun/article/details/77803178 以下内容来自慕课网的课程:基于SSH实现员工管理系统之框架整 ...
- WIN10护眼色
参看文章:http://www.xitongcheng.com/jiaocheng/win10_article_10326.html WIN10:[HKEY_CURRENT_USER\Control ...
- Eclipse Creating a New Runnable JAR File 清理工作空间下的配置文件
D:\workspacegit\.metadata\.plugins\org.eclipse.debug.core\.launches 相关文件存在这里.
- Array与Object
typeof([ ])的返回值是object,因为数组叫做数组对象. Array有length属性,而Object没有length属性,所以可以根据length属性来判断数据属于数组还是对象. Arr ...