From 6cce87e379085b8a9fe9e56a2b1599a77bf57e21 Mon Sep 17 00:00:00 2001 From: Michael Grote Date: Thu, 8 Apr 2021 18:45:01 +0200 Subject: [PATCH] =?UTF-8?q?Scripte=20aufgeteilt=20in=20videos=20und=20alle?= =?UTF-8?q?s;=20f=C3=BCr=208TB=20Platte?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...rver-hdds.ps1 => fileserver-hdds-alles.ps1 | 12 +++--- fileserver-hdds-videos.ps1 | 39 +++++++++++++++++++ 2 files changed, 45 insertions(+), 6 deletions(-) rename fileserver-hdds.ps1 => fileserver-hdds-alles.ps1 (88%) create mode 100644 fileserver-hdds-videos.ps1 diff --git a/fileserver-hdds.ps1 b/fileserver-hdds-alles.ps1 similarity index 88% rename from fileserver-hdds.ps1 rename to fileserver-hdds-alles.ps1 index f2dab50..a10e0cc 100644 --- a/fileserver-hdds.ps1 +++ b/fileserver-hdds-alles.ps1 @@ -22,24 +22,24 @@ $quelle1 ="\\fileserver2.grote.lan\mg" $quelle2 ="\\fileserver2.grote.lan\Musik" $quelle3 ="\\fileserver2.grote.lan\amd" $quelle4 ="\\fileserver2.grote.lan\backup" -$quelle5 ="\\fileserver2.grote.lan\Videos\Filme - ueberragende" -$quelle6 ="\\fileserver2.grote.lan\Videos\Serien - überragende" +$quelle5 ="" +$quelle6 ="" $quelle7 ="\\fileserver2.grote.lan\bilder" $quelle8 ="\\fileserver2.grote.lan\proxmox" $quelle1_name= "mg" $quelle2_name= "musik" $quelle3_name= "amd" $quelle4_name= "backup" -$quelle5_name= "filme" -$quelle6_name= "serien" +$quelle5_name= "" +$quelle6_name= "" $quelle7_name= "bilder" $quelle8_name= "proxmox" $ziel1="$scriptpfad\backup\mg" $ziel2="$scriptpfad\backup\Musik" $ziel3="$scriptpfad\backup\amd" $ziel4="$scriptpfad\backup\backup" -$ziel5="$scriptpfad\backup\Videos\Filme - ueberragende" -$ziel6="$scriptpfad\backup\Videos\Serien - ueberragende" +$ziel5="" +$ziel6="" $ziel7="$scriptpfad\backup\bilder" $ziel8="$scriptpfad\backup\proxmox" diff --git a/fileserver-hdds-videos.ps1 b/fileserver-hdds-videos.ps1 new file mode 100644 index 0000000..77a4f66 --- /dev/null +++ b/fileserver-hdds-videos.ps1 @@ -0,0 +1,39 @@ +# Funktion: speichert den aktuellen PFad(vgl. pwd) in Get-ScriptDirectory +function Get-ScriptDirectory { + $Invocation = (Get-Variable MyInvocation -Scope 1).Value + Split-Path $Invocation.MyCommand.Path +} + +# Funktion: setze Timestamp, mit Rückgabewert +function get-timestamp{ + $timestamp = (get-date -Format yyyy_MM_dd__HH_mm_ss) + return $timestamp +} + +# restliche Variablen +$timestamp = get-timestamp # Ruft Funktion get-timestamp auf +$scriptpfad = Get-ScriptDirectory # setzt $scriptpfad auf den Wert von Get-ScriptDirectory +# Hhostname +$hostname_ist = $env:computername +$hostname_soll = "irantu" + +# Ziele/Quellen +$quelle1 ="\\fileserver2.grote.lan\videos" +$quelle1_name= "videos" +$ziel1="$scriptpfad\backup\videos" + + +# Hostname prüfen +if ($hostname_ist -eq $hostname_soll) + { + Write-Host "Host = $hostname_ist" + } + else + { + Write-Host "Falscher Host(SOLL: '$hostname_soll' IST:$hostname_ist)" + start-sleep 5 + Exit 1 + } + +robocopy $quelle1 $ziel1 /MIR /R:3 /W:10 /DST /TEE /UNILOG+:"$scriptpfad\$timestamp-$quelle1_name.log" +