7 lug 2026

Pulire file log di Outlook ...

 Soliti appunti per lasciar traccia su un aspetto antipatico di Outlook (Classic, non so se ne sia affetto anche il Modern).
Non mi è chiaro quale attività attivi questi log, ma dopo diverso tempo la cartella %temp%\Outlook Logging può raggiungere diverse decine di giga. Con lo script qui sotto, è possibile eliminarli per tutti i profili del PC in cui lo andremo ad eseguire

------------------------------------------------------------------------------

# Get all Users

$Users = Get-ChildItem -Path "$($ENV:SystemDrive)\Users"

# Process all the Users

$Users | ForEach-Object {

      Write-Host "Processing user: $($_.Name)" -ForegroundColor Cyan

      $path = "$($ENV:SystemDrive)\Users\$($_.Name)\AppData\Local\Temp\Outlook Logging\"

      If (Test-Path $path) {

        Write-host "Removing log files from $path" -ForegroundColor Cyan

        Remove-Item -Path $path -Recurse

        Write-host "Creating dummy file to prevent log files" -ForegroundColor Cyan

        New-Item -Path "$($ENV:SystemDrive)\Users\$($_.Name)\AppData\Local\Temp" -Name "Outlook Logging" -ItemType File

      }

}

------------------------------------------------------------------------------


0 commenti:

Posta un commento