Reference:
How To Clean Up WSUS
我的 WSUS server C:\ 被塞滿了,檢查發現 WsusContent 目錄有 120GB。
先用 WSUS 的 Server Cleanup Wizard,跑完後完全沒有縮小!
找到上面那一篇的方法重抓 WSUS 資料後只用了 17GB。
步驟:
1. 將 Automatic Approvals 停掉
2. 刪除 C:\WSUS\WsusContent 目錄下所有的檔案
3. 執行下面這一段 batch file,重設 WSUS database
net stop wsusservice
cd "C:\Program Files\Update Services\Tools"
wsusutil.exe reset
echo Delete WSUS Folder Content
pause
net start wsusservice
4. 在 WSUS 執行 Synchrozine Now
5. Open PowerShell ISE as Administrator and run the script
#Change server name and port number and $True if it is on SSL
$Computer = $env:COMPUTERNAME
$Domain = $env:USERDNSDOMAIN
$FQDN = "$Computer" + "." + "$Domain"
[String]$updateServer1 = $FQDN
[Boolean]$useSecureConnection = $False
[Int32]$portNumber = 8530
# Load .NET assembly
[void][reflection.assembly]::LoadWithPartialName("Microsoft.UpdateServices.Administration")
$count = 0
# Connect to WSUS Server
$updateServer = [Microsoft.UpdateServices.Administration.AdminProxy]::getUpdateServer($updateServer1,$useSecureConnection,$portNumber)
write-host "<<<Connected sucessfully >>>" -foregroundcolor "yellow"
$updatescope = New-Object Microsoft.UpdateServices.Administration.UpdateScope
$u=$updateServer.GetUpdates($updatescope )
foreach ($u1 in $u )
{
if ($u1.IsSuperseded -eq 'True')
{
write-host Decline Update : $u1.Title
$u1.Decline()
$count=$count + 1
}
}
write-host Total Declined Updates: $count
trap
{
write-host "Error Occurred"
write-host "Exception Message: "
write-host $_.Exception.Message
write-host $_.Exception.StackTrace
exit
}
# EOF
沒有留言:
張貼留言