51 lines
1.4 KiB
PowerShell
51 lines
1.4 KiB
PowerShell
|
#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 = "frida"
|
|||
|
|
|||
|
#### restic ####
|
|||
|
### repository
|
|||
|
$repository="\\OMVV2.grote.lan\Backup-v2\restic"
|
|||
|
### ordner für sicherung
|
|||
|
$ordner1="C:\1_Bewerbung"
|
|||
|
$ordner2="C:\2_Fotos"
|
|||
|
$ordner3="C:\3_Rezepte"
|
|||
|
$ordner4="C:\4_Projekte"
|
|||
|
$ordner5="C:\5.1_Zeichnungen_Krita"
|
|||
|
$ordner6="C:\5_Zeichnungen_Painter"
|
|||
|
$ordner7="C:\6_Wohnung"
|
|||
|
$ordner8="C:\7_Sonstiges"
|
|||
|
$ordner9="C:\Users\Anne-"
|
|||
|
### passwordfile
|
|||
|
$passwordfile="C:\Users\Anne-\Desktop\Nextcloud\Programme\restic\config\password.txt"
|
|||
|
### exclude file
|
|||
|
$excludefile="C:\Users\Anne-\Desktop\Nextcloud\Programme\restic\config\exclude.txt"
|
|||
|
### aktion/befehl
|
|||
|
$befehl="backup"
|
|||
|
|
|||
|
|
|||
|
# 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
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
C:\Users\Anne-\Desktop\Nextcloud\Programme\restic\bin\restic.exe -r $repository --password-file $passwordfile $befehl --exclude-file $excludefile $ordner1 $ordner2 $ordner3 $ordner4 $ordner5 $ordner6 $ordner7 $ordner8 $ordner9
|