Files
management-scripts/Cleanup-AppXTempFiles.ps1
T
2020-08-18 16:20:20 -04:00

9 lines
689 B
PowerShell

## This script will remove runaway AppX temp files that can consume 100's of GB on an endpoint
## Only run this script on Windows 8 or higher endpoints
$WindowsVersion = [double]("{0}.{1}" -f ([System.Environment]::OSVersion.Version).Major,([System.Environment]::OSVersion.Version).Minor)
If ( $WindowsVersion -ge 6.2 )
{
Get-ChildItem -Path "${Env:SystemRoot}\Temp" | Where { $_.Name -like "AppXDeploymentServer_*.evtx" }| Remove-Item -Force
Get-ChildItem -Path "${Env:SystemRoot}\Temp" | Where { $_.Name -like "AppxErrorReport_*.txt" } | Remove-Item -Force
Get-ChildItem -Path "${Env:SystemRoot}\Temp" | Where { $_.Name -like "AppXPackaging_*.evtx" }| Remove-Item -Force
}