Папка windows\temp забивается файлами cab_xxxx

Данная проблема вызвана сбоем службы автоматического обновления Windows, в частности при работе с серверами обновлений WSUS.

Пошаговое решение проблемы выглядит так:

  1. Остановка службы обновлений (wuauserv)
  2. Остановка службы trustedinstaller
  3. Удаление содержимого папки c:\windows\temp
  4. Удаление cab-файлов из папки c:\windows\logs\CBS
  5. Удаление папки  C:\windows\softwaredistribution
  6. Запуск сервиса trustedinstaller
  7. Запуск службы обновления

Для удаленного автоматического решения проблемы можно воспользоваться скриптом:

fix_winupdate_tmp_cab.ps1
 
  1. $Machine = read-host "Type in the Computer Name"
  2. $windowsUpdateService = 'wuauserv'
  3. $trustedInstallerService = 'trustedinstaller'
  4. function Set-ServiceState
  5. {
  6.     [CmdletBinding()]
  7.     param(
  8.         [string]$ComputerName,
  9.         [string]$ServiceName
  10.     )
  11.     Write-Verbose "Evaluating $ServiceName on $ComputerName."
  12.     [string]$WaitForIt = ""
  13.     [string]$Verb = ""
  14.     [string]$Result = "FAILED"
  15.     $svc = Get-Service -computername $ComputerName -name $ServiceName
  16.     Switch ($svc.status) {
  17.         'Stopped' {
  18.             Write-Verbose "[$ServiceName] is currently Stopped. Starting."
  19.             $Verb = "start"
  20.             $WaitForIt = 'Running'
  21.             $svc.Start()
  22.         }
  23.         'Running' {
  24.             Write-Verbose "[$ServiceName] is Running. Stopping."
  25.             $Verb = "stop"
  26.             $WaitForIt = 'Stopped'
  27.             $svc.Stop()
  28.         }
  29.         default {
  30.             Write-Verbose "$ServiceName is $($svc.status). Taking no action."
  31.         }
  32.     }
  33.     if ($WaitForIt -ne "") {
  34.         Try { # For some reason, we cannot use -ErrorAction after the next statement:
  35.             $svc.WaitForStatus($WaitForIt,'00:02:00')
  36.         } Catch {
  37.             Write-Warning "After waiting for 2 minutes, $ServiceName failed to $Verb."
  38.         }
  39.         $svc = (get-service -computername $ComputerName -name $ServiceName)
  40.         if ($svc.status -eq $WaitForIt) {
  41.             $Result = 'SUCCESS'
  42.         }
  43.         Write-Verbose "$Result - $ServiceName on $ComputerName is $($svc.status)"
  44.         Write-Verbose ("{0} - {1} on {2} is {4}" -f $Result, $ServiceName, $ComputerName, $svc.status)
  45.     }
  46. }
  47. # stop update service
  48. Write-Host "stop update service"
  49. Set-ServiceState -ComputerName $Machine -ServiceName $windowsUpdateService -Verbose
  50. #removes temp files and renames software distribution folder
  51. Write-Host "removes temp files and renames software distribution folder"
  52. Remove-Item \\$Machine\c$\windows\temp\* -recurse
  53. Rename-Item \\$Machine\c$\windows\SoftwareDistribution SoftwareDistribution.old
  54. #restarts update service
  55. Write-Host "restarts update service"
  56. Set-ServiceState -ComputerName $Machine -ServiceName $windowsUpdateService
  57. #removes software distribution.old
  58. Write-Host "removes software distribution.old"
  59. Remove-Item \\$Machine\c$\windows\SoftwareDistribution.old -recurse
  60. #stops trustedinstaller service
  61. Write-Host "stops trustedinstaller service"
  62. Set-ServiceState -ComputerName $Machine -ServiceName $trustedInstallerService
  63. #removes cab files from trustedinstaller
  64. Write-Host "removes cab files from trustedinstaller"
  65. remove-item \\$Machine\c$\windows\Logs\CBS\* -recurse
  66. #restarts trustedinstaller service
  67. Write-Host "restarts trustedinstaller service"
  68. Set-ServiceState -ComputerName $Machine -ServiceName $trustedInstallerService
  69. #rebuilds cab files from WSUS
  70. Write-Host "rebuilds cab files from WSUS"
  71. invoke-command -ComputerName $Machine -ScriptBlock { & cmd.exe "c:\windows\system32\wuauclt.exe /detectnow" }

Источник: https://community.spiceworks.com/topic/495234-windows-temp-file-is-full-of-cab_xxxx-files-on-windows-server-2008-r2