From 98300685ce08a63df47d800a843d14606301e266 Mon Sep 17 00:00:00 2001 From: "michael.grote" <38253905+quotengrote@users.noreply.github.com> Date: Tue, 9 Jun 2020 10:17:04 +0200 Subject: [PATCH] win10vm eingerichtet --- backup_win10vm_schule.ps1 | 46 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 backup_win10vm_schule.ps1 diff --git a/backup_win10vm_schule.ps1 b/backup_win10vm_schule.ps1 new file mode 100644 index 0000000..450bf3c --- /dev/null +++ b/backup_win10vm_schule.ps1 @@ -0,0 +1,46 @@ +#Variablen +#Variablen setzen +#variablendeklaration pfade +#scriptpfad ermitteln +#funktion get-scriptdirectory definieren +function Get-ScriptDirectory { + $Invocation = (Get-Variable MyInvocation -Scope 1).Value + Split-Path $Invocation.MyCommand.Path +} +#funktion an variable zuweisen +$scriptpfad = Get-ScriptDirectory +#hostname +$hostname_ist = $env:computername +$hostname_soll = "vmw10mg" + +#### restic #### +### repository +$repository="\\fileserver.grote.lan\Backup\restic" +### ordner fuer sicherung +$ordner1="C:\Users\mg\Desktop\NextCloud" +$ordner2="" +$ordner3="" +$ordner4="" +$ordner5="" +### passwordfile +$passwordfile="C:\Users\mg\Desktop\NextCloud\Programme\restic\config\password.txt" +### exclude file +$excludefile="C:\Users\mg\Desktop\NextCloud\Programme\restic\config\exclude.txt" +### aktion/befehl +$befehl="backup" + + +# Hostname pruefen +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 + } + + +C:\Users\mg\Desktop\NextCloud\Programme\restic\bin\restic.exe -r $repository --password-file $passwordfile $befehl --exclude-file $excludefile $ordner1 $ordner2 $ordner3 $ordner4 $ordner5 \ No newline at end of file