世界杯积分榜_世界杯几年一届 - fjmzsy.com

用powershell 批量卸载 windows 更新

5753

用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

在线教学、视频会议(含 文本、语音、视频聊天、电子白板)

posted @

2014-02-28 15:57

疯吻IT

阅读(5689)

评论(0)

收藏

举报

对抗路一姐花木兰都被哪些英雄所克制?丨英雄克制
在一家公司干多长时间跳槽才合适?跳的太频繁工资会更低!