diff --git a/Cleanup-SystemTempFiles.ps1 b/Cleanup-SystemTempFiles.ps1 index 3179d22..836d388 100644 --- a/Cleanup-SystemTempFiles.ps1 +++ b/Cleanup-SystemTempFiles.ps1 @@ -104,6 +104,18 @@ If ( Test-Path $ESDB ) { } +# Remove any Autodesk installers at their default location +$ADSKInst = "${Env:SystemDrive}\Autodesk" +If ( Test-Path $ADSKInst ) { + $foldersToDelete = Get-ChildItem -Path $ADKSInst -ErrorAction SilentlyContinue | Where-Object { ($_.PSIsContainer) -and ($_.LastWriteTime -lt ((Get-Date) - $TimeDelta)) -and ( $_.Name -ne "WI") } + ForEach ( $folder in $foldersToDelete ) { + $path = $folder.FullName + LogMsg "Deleting Autodesk installer directory: ""${path}""" + Try { Remove-Item $folder -Force -Recurse -ErrorAction SilentlyContinue } + Catch { LogErr $_.Exception.Message } + } +} + # TODO: Evaluate system restore points and delete them if they take up too much space # Remove files from user profile directories