Win7專業(yè)版系統(tǒng)怎么批量刪除系統(tǒng)更新補丁
2018-04-17 15:47
微軟都會不定時的給Windows操作系統(tǒng)推送補丁進行更新,而有時候win7系統(tǒng)用戶發(fā)現(xiàn)更新之后可能覺得沒有什么用就想要卸載,一般只需要到添加刪除里面點擊查看已安裝更新然后就可以手動卸載了,不過如果要刪除多個系統(tǒng)更新補丁的話一個個卸載太麻煩了,那么要怎么批量刪除系統(tǒng)更新補丁呢,下面以win7專業(yè)版系統(tǒng)為例,為大家分享一下批量刪除系統(tǒng)更新補丁的具體步驟。
1、在e盤,新建記事本,把以下代碼復制其中,然后保存為文件名為a.ps1;
$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
2、點開開始-找到搜索-輸入cmd-右鍵選擇管理員打開;
3、輸入PowerShell ,然后回車;
4、輸入Set-ExecutionPolicy RemoteSigned ,然后回車;
5、輸入E:a.ps1,然后回車。
關于Win7專業(yè)版系統(tǒng)怎么批量刪除系統(tǒng)更新補丁就給大家介紹到這邊了,有需要的用戶們可以采取上面的方法步驟來進行操作,更多精彩內容歡迎繼續(xù)關注最新win7系統(tǒng)下載站!
1、在e盤,新建記事本,把以下代碼復制其中,然后保存為文件名為a.ps1;
$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
2、點開開始-找到搜索-輸入cmd-右鍵選擇管理員打開;
3、輸入PowerShell ,然后回車;
4、輸入Set-ExecutionPolicy RemoteSigned ,然后回車;
5、輸入E:a.ps1,然后回車。
關于Win7專業(yè)版系統(tǒng)怎么批量刪除系統(tǒng)更新補丁就給大家介紹到這邊了,有需要的用戶們可以采取上面的方法步驟來進行操作,更多精彩內容歡迎繼續(xù)關注最新win7系統(tǒng)下載站!
網(wǎng)友評論