# Mirror für Dateien Ordner und Rechte incl. Berechtigungen
#log File wird geschrieben C:\Logs\Sync.log
$Source = "\\fileserver\d$\Alles"
$Destination = "\\neuerfileserver\d$\Alles"
write-host ''
Write-Host '===========================================================' -ForegroundColor Green
Write-Host ' Start file copy process for ' -ForegroundColor Black -BackgroundColor Yellow
Write-Host $Source -ForegroundColor Black -BackgroundColor Yellow
Write-Host '===========================================================' -ForegroundColor Green
write-host ''
robocopy $source $destination /MIR /B /COPYALL /R:1 /W:5 /Sec /Log:C:\Logs\Sync.log
do
{
$Log = Get-Content C:\Logs\Sync.log -Tail 2
$Check = ($Log | Select-String -Pattern "Beendet: " -CaseSensitive).Matches.Success
Start-Sleep -Seconds 10
} Until ($Check -eq 'true')
write-host ''
Write-Host '===========================================================' -ForegroundColor Green
Write-Host ' Mirror finished ' -ForegroundColor Black -BackgroundColor Yellow
Write-Host '===========================================================' -ForegroundColor Green
write-host ''
Remove-Item C:\Logs\Sync.log -Force