Outlook – Synchronisierungsprobleme automatisch löschen

Mit diesem Skript löscht ihr über den Taskplaner automatisch die E-Mails aus dem Ordner Synchronisierungsprobleme in Outlook.

$c = ‘-command “Start-Transcript C:\LOGS\OUSync.log -append -force; Stop-Transcript;$Outlook = New-Object -ComObject Outlook.Application; $SyncIssues = $Outlook.Session.GetDefaultFolder([Microsoft.Office.Interop.Outlook.OlDefaultFolders]::olFolderSyncIssues); For ([int]$i = $SyncIssues.Items.Count; $i -ge 1; $i-=1) {$SyncIssues.Items.Item($i).Delete()};exit $LASTEXITCODE;”‘
$A = New-ScheduledTaskAction –Execute “C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe” -Argument $c
$T = New-ScheduledTaskTrigger -Weekly -DaysOfWeek Monday,Wednesday,Friday -At “10:00:00”
$S = New-ScheduledTaskSettingsSet
$P = New-ScheduledTaskPrincipal -UserId “$Env:UserDomain\$Env:Username” -LogonType ServiceAccount -RunLevel highest

New-ScheduledTask -Action $A -Principal $P -Trigger $T -Settings $S -Description “SyncProbDelete” |Register-ScheduledTask -Taskname “SyncProbDelete” -TaskPath “\DWP\Joern”

Weitere Optionen beim Anlegen eines Tasks über die Powershell:

# -LogonType Interactive
# -LogonType Password P@ssw0rd
# -LogonType ServiceAccount -RunLevel highest
# -RunLevel limited
# New-ScheduledTaskAction powershell.exe -Argument “-file c:\Scripts\SyncProbDelete.ps1” -WorkingDirectory “C:\WINDOWS\system32\WindowsPowerShell\v1.0”
# New-ScheduledTaskAction -Execute “image.exe”
# New-ScheduledTaskSettingsSet -MultipleInstances Parallel
# New-ScheduledTaskSettingsSet -DontStopOnIdleEnd -ExecutionTimeLimit ([TimeSpan]::Zero)
# New-ScheduledTaskPrincipal -UserID “NT AUTHORITY\SYSTEM”
# New-ScheduledTaskPrincipal -GroupId “ndsedv.de\TaskGroup”
# New-ScheduledTaskTrigger -AtStartup
# New-ScheduledTaskTrigger -daily -at 12:00PM
# New-ScheduledTaskTrigger -Once -At $startTime -RepetitionInterval (New-TimeSpan -Minutes 1) -RepetitionDuration ([Timespan]::MaxValue)
# Get-ScheduledTask SyncProbDelete | Select -ExpandProperty Principal
# schtasks /create /tn “SyncProbDelete” /xml “Test SyncProbDelete.xml”
# schtasks.exe /create /s NAMEOFCOMPUTER /ru DOMAIN\USER /rp PASSWORD /tn NAMEOFTASK’ /XML PATHTOXMLFILE

Weiterführende Informationen:

https://support.microsoft.com/de-ch/help/842284/how-to-troubleshoot-synchronization-problems-when-you-synchronize-your-exchange-server-mailbox-with-your-.ost-file-in-Outlook