Last active
June 5, 2025 11:20
-
-
Save Bouni/b30b02ad3d30a96415ec90995a2b93a0 to your computer and use it in GitHub Desktop.
Erstellen eines Backups der FE2 Config & Datenbank
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ProgressPreference = 'SilentlyContinue' | |
Write-Host "FE2 Backup erzeugen" | |
# Temporäres Verzeichnis für die Config erstellen | |
$tempFolder = Join-Path -Path $env:TEMP -ChildPath "Alamos_Backup_$(Get-Random)" | |
New-Item -ItemType Directory -Path "$tempFolder\config", "$tempFolder\db" -Force | |
Write-Host "Datenbank Dump erzeugen" | |
$dbDestinationArchive = "$tempFolder\db\FE2-DB-Archive.gz" | |
# Passwort aus der Registry lesen | |
$registryPath = "Registry::HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Prefs\de.alamos.fe2.server.services./Registry/Service" | |
$valueName = "dbpassword" | |
$value = Get-ItemProperty -Path $registryPath -Name $valueName | |
$dbPassword = $value.$valueName | |
Write-Host "Datenbak Passowrt $dbPassword" | |
# Datenbank Dump mit Mongodump erzeugen | |
$processOptions = @{ | |
FilePath = "C:\Program Files\Alamos GmbH\FE2\files\mongodb\bin\mongodump.exe" | |
ArgumentList = "--username Admin --password $dbPassword --gzip --port=27018 --archive=$dbDestinationArchive" | |
} | |
Start-Process @processOptions -NoNewWindow -Wait | |
Write-Host "ZIP Archiv der Datenbank erstellt: $dbDestinationArchive" | |
# Benutzername des aktuellen Benutzers | |
$currentUser = $env:USERNAME | |
# Config Verzeichnis von FE2 | |
$configSourceFolder = "C:\\ProgramData\\Alamos GmbH\\FE2\\Config" | |
# Ziel verzeichnis für das Backup Archiv | |
$configDestinationArchive = "C:\Users\$currentUser\Desktop\FE2-Backup.zip" | |
# Config ins Temporäre Verzeichnis kopieren | |
robocopy $configSourceFolder "$tempFolder\config" /S /PURGE /XF license.fe2lf /XD database | |
# Zip Archiv der Files im Temporären verzeichnis erstellen | |
Compress-Archive -Path $tempFolder\* -DestinationPath $configDestinationArchive -CompressionLevel Optimal -Force | |
# Temporäres Verzeichnis löschen | |
Remove-Item -Path $tempFolder -Recurse -Force | |
Write-Host "ZIP Archiv erstellt: $configDestinationArchive" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment