logs Ordner erstellen
This commit is contained in:
parent
2a3f12bdef
commit
9a073fafd4
4 changed files with 27 additions and 2 deletions
|
@ -13,10 +13,11 @@ function get-timestamp{
|
||||||
# restliche Variablen
|
# restliche Variablen
|
||||||
$timestamp = get-timestamp # Ruft Funktion get-timestamp auf
|
$timestamp = get-timestamp # Ruft Funktion get-timestamp auf
|
||||||
$scriptpfad = Get-ScriptDirectory # setzt $scriptpfad auf den Wert von Get-ScriptDirectory
|
$scriptpfad = Get-ScriptDirectory # setzt $scriptpfad auf den Wert von Get-ScriptDirectory
|
||||||
# Hhostname
|
# Hostname
|
||||||
$hostname_ist = $env:computername
|
$hostname_ist = $env:computername
|
||||||
$hostname_soll = "irantu"
|
$hostname_soll = "irantu"
|
||||||
|
|
||||||
|
|
||||||
# Ziele/Quellen
|
# Ziele/Quellen
|
||||||
$quelle1 ="\\fileserver2.grote.lan\mg"
|
$quelle1 ="\\fileserver2.grote.lan\mg"
|
||||||
$quelle2 ="\\fileserver2.grote.lan\Musik"
|
$quelle2 ="\\fileserver2.grote.lan\Musik"
|
||||||
|
@ -55,6 +56,13 @@ if ($hostname_ist -eq $hostname_soll)
|
||||||
Exit 1
|
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 $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 $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"
|
robocopy $quelle3 $ziel3 /MIR /R:3 /W:10 /DST /TEE /UNILOG+:"$scriptpfad\logs\$timestamp-$quelle3_name.log"
|
||||||
|
|
|
@ -35,5 +35,10 @@ if ($hostname_ist -eq $hostname_soll)
|
||||||
Exit 1
|
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"
|
||||||
|
|
|
@ -39,6 +39,11 @@ if ($hostname_ist -eq $hostname_soll)
|
||||||
Exit 1
|
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 $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"
|
robocopy $quelle2 $ziel2 /MIR /R:3 /W:10 /DST /TEE /UNILOG+:"$scriptpfad\logs\$timestamp-$quelle2_name.log"
|
||||||
|
|
|
@ -37,6 +37,7 @@ $ziel4="$scriptpfad\backup\musik"
|
||||||
$ziel5="$scriptpfad\backup\videos"
|
$ziel5="$scriptpfad\backup\videos"
|
||||||
$ziel6="$scriptpfad\backup\rest"
|
$ziel6="$scriptpfad\backup\rest"
|
||||||
|
|
||||||
|
|
||||||
# Hostname prüfen
|
# Hostname prüfen
|
||||||
if ($hostname_ist -eq $hostname_soll)
|
if ($hostname_ist -eq $hostname_soll)
|
||||||
{
|
{
|
||||||
|
@ -49,6 +50,12 @@ if ($hostname_ist -eq $hostname_soll)
|
||||||
Exit 1
|
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 $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 $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
|
robocopy $quelle3 $ziel3 /MIR /R:3 /W:10 /DST /TEE /UNILOG+:"$scriptpfad\logs\$timestamp-$quelle3_name.log" /XD $quelle3\@recycle $quelle3\@Recently-Snapshot
|
||||||
|
|
Loading…
Reference in a new issue