logs Ordner erstellen

This commit is contained in:
Michael Grote 2021-05-07 08:29:01 +02:00
parent 2a3f12bdef
commit 9a073fafd4
4 changed files with 27 additions and 2 deletions

View file

@ -13,10 +13,11 @@ function get-timestamp{
# restliche Variablen
$timestamp = get-timestamp # Ruft Funktion get-timestamp auf
$scriptpfad = Get-ScriptDirectory # setzt $scriptpfad auf den Wert von Get-ScriptDirectory
# Hhostname
# Hostname
$hostname_ist = $env:computername
$hostname_soll = "irantu"
# Ziele/Quellen
$quelle1 ="\\fileserver2.grote.lan\mg"
$quelle2 ="\\fileserver2.grote.lan\Musik"
@ -55,6 +56,13 @@ if ($hostname_ist -eq $hostname_soll)
Exit 1
}
# logs Ordner erstellen
If(!(test-path $scriptpfad\logs))
{
New-Item -ItemType Directory -Force -Path $scriptpfad\logs
}
robocopy $quelle1 $ziel1 /MIR /R:3 /W:10 /DST /TEE /UNILOG+:"$scriptpfad\logs\$timestamp-$quelle1_name.log" /XD "\\fileserver2.grote.lan\mg\Programme\Spiele - nicht gesichert"
robocopy $quelle2 $ziel2 /MIR /R:3 /W:10 /DST /TEE /UNILOG+:"$scriptpfad\logs\$timestamp-$quelle2_name.log"
robocopy $quelle3 $ziel3 /MIR /R:3 /W:10 /DST /TEE /UNILOG+:"$scriptpfad\logs\$timestamp-$quelle3_name.log"

View file

@ -35,5 +35,10 @@ if ($hostname_ist -eq $hostname_soll)
Exit 1
}
robocopy $quelle1 $ziel1 /MIR /R:3 /W:10 /DST /TEE /UNILOG+:"$scriptpfad\logs\$timestamp-$quelle1_name.log"
# logs Ordner erstellen
If(!(test-path $scriptpfad\logs))
{
New-Item -ItemType Directory -Force -Path $scriptpfad\logs
}
robocopy $quelle1 $ziel1 /MIR /R:3 /W:10 /DST /TEE /UNILOG+:"$scriptpfad\logs\$timestamp-$quelle1_name.log"

View file

@ -39,6 +39,11 @@ if ($hostname_ist -eq $hostname_soll)
Exit 1
}
# logs Ordner erstellen
If(!(test-path $scriptpfad\logs))
{
New-Item -ItemType Directory -Force -Path $scriptpfad\logs
}
robocopy $quelle1 $ziel1 /MIR /R:3 /W:10 /DST /TEE /UNILOG+:"$scriptpfad\logs\$timestamp-$quelle1_name.log"
robocopy $quelle2 $ziel2 /MIR /R:3 /W:10 /DST /TEE /UNILOG+:"$scriptpfad\logs\$timestamp-$quelle2_name.log"

View file

@ -37,6 +37,7 @@ $ziel4="$scriptpfad\backup\musik"
$ziel5="$scriptpfad\backup\videos"
$ziel6="$scriptpfad\backup\rest"
# Hostname prüfen
if ($hostname_ist -eq $hostname_soll)
{
@ -49,6 +50,12 @@ if ($hostname_ist -eq $hostname_soll)
Exit 1
}
# logs Ordner erstellen
If(!(test-path $scriptpfad\logs))
{
New-Item -ItemType Directory -Force -Path $scriptpfad\logs
}
robocopy $quelle1 $ziel1 /MIR /R:3 /W:10 /DST /TEE /UNILOG+:"$scriptpfad\logs\$timestamp-$quelle1_name.log" /XD $quelle1\@recycle $quelle1\@Recently-Snapshot
robocopy $quelle2 $ziel2 /MIR /R:3 /W:10 /DST /TEE /UNILOG+:"$scriptpfad\logs\$timestamp-$quelle2_name.log" /XD $quelle2\@recycle $quelle2\@Recently-Snapshot
robocopy $quelle3 $ziel3 /MIR /R:3 /W:10 /DST /TEE /UNILOG+:"$scriptpfad\logs\$timestamp-$quelle3_name.log" /XD $quelle3\@recycle $quelle3\@Recently-Snapshot