Neue Skripte hinzugefügt

This commit is contained in:
root
2026-08-05 19:35:01 +02:00
parent 6fbc1b1147
commit 4b76addbaa
5 changed files with 2956 additions and 0 deletions
+603
View File
@@ -0,0 +1,603 @@
#Requires -RunAsAdministrator
<#
.SYNOPSIS
Unattended Installation Veeam Backup & Replication v13
.DESCRIPTION
Installation von Veeam Backup & Replication v13
mit vorhandener Microsoft SQL Server 2019 Instanz.
Quelle:
\\172.68.1.1\Sources
Datenbank:
<Servername>\VEEAMSQLSERVER
#>
############################################################
# VARIABLEN
############################################################
############################################################
# INSTALLATIONSQUELLEN
############################################################
# Lokale DVD / ISO Quelle
$DVDSource = "E:\"
# Netzwerkquelle
$NetworkSource = "\\172.68.1.1\Sources"
############################################################
# QUELLE AUSWÄHLEN
############################################################
Write-Host ""
Write-Host "Veeam Installationsquelle"
Write-Host "========================="
Write-Host "1 = DVD / ISO Quelle ($DVDSource)"
Write-Host "2 = Netzwerkquelle ($NetworkSource)"
Write-Host ""
$SourceChoice = Read-Host "Quelle auswählen (1 oder 2)"
switch ($SourceChoice)
{
"1"
{
$VeeamSource = $DVDSource
Write-Host ""
Write-Host "Lokale Quelle gewählt:"
Write-Host $VeeamSource
}
"2"
{
$VeeamSource = $NetworkSource
Write-Host ""
Write-Host "Anmeldung an Netzwerkquelle"
$Credential = Get-Credential
try
{
New-PSDrive `
-Name "VEEAMSRC" `
-PSProvider FileSystem `
-Root $VeeamSource `
-Credential $Credential `
-ErrorAction Stop | Out-Null
$VeeamSource = "VEEAMSRC:\"
Write-Host ""
Write-Host "Netzwerkquelle verbunden:"
Write-Host $VeeamSource
}
catch
{
Write-Host ""
Write-Host "Fehler beim Verbinden der Netzwerkquelle"
Write-Host $_.Exception.Message
exit 1
}
}
default
{
Write-Host "Ungültige Auswahl"
exit 1
}
}
# Installer
$VeeamInstaller = `
"$VeeamSource\Setup\Silent\Veeam.Silent.Install.exe"
# Antwortdatei
$AnswerFileSource = `
"$VeeamSource\Setup\Silent\AnswerFiles\VBR\VbrAnswerFile_install.xml"
# Arbeitsverzeichnis lokal
$WorkDir = "C:\Temp\VeeamInstall"
$LogDir = "$WorkDir\Logs"
# Lizenz
$LicenseSource = "$VeeamSource\License\veeam.lic"
$LicenseTarget = "$WorkDir\veeam.lic"
# Servername
$VeeamServerName = $env:COMPUTERNAME
# SQL Server
$SQLInstanceName = "VEEAMSQLSERVER"
$SQLConnection = `
"$VeeamServerName\$SQLInstanceName"
# SQL Datenbank
$DatabaseName = "VeeamBackup"
# 0 = Windows Authentication
$SQLAuthentication = 0
# Installationspfade
$InstallPath = "F:\Program Files\Veeam\Backup and Replication"
$CatalogPath = "H:\VBRCatalog"
$IRCachePath = "F:\ProgramData\Veeam\Backup\IRCache"
# Ports
$GuestCatalogPort = 9393
$VeeamServicePort = 9392
$SecureConnectionPort = 9401
$RestServicePort = 9419
# Plugins deaktivieren
$Plugins = @{
"AHV_INSTALL" = 0
"KVM_INSTALL" = 0
"PVE_INSTALL" = 0
"SCP_INSTALL" = 0
"AWS_INSTALL" = 0
"AZURE_INSTALL" = 0
"GCP_INSTALL" = 0
"KASTEN_INSTALL" = 0
}
# Neustart nicht automatisch
$RebootRequired = 0
############################################################
# FUNKTIONEN
############################################################
function Write-Log {
param(
[string]$Message
)
$Time = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
"$Time - $Message" |
Tee-Object `
-FilePath "$LogDir\Install.log" `
-Append
}
############################################################
# START
############################################################
Write-Log "==== Veeam v13 Installation gestartet ===="
############################################################
# Verzeichnisse
############################################################
New-Item `
$WorkDir `
-ItemType Directory `
-Force | Out-Null
New-Item `
$LogDir `
-ItemType Directory `
-Force | Out-Null
############################################################
# Quelle prüfen
############################################################
if (!(Test-Path $VeeamInstaller)) {
Write-Log "FEHLER: Installer nicht gefunden"
exit 1
}
Write-Log "Installationsquelle OK"
############################################################
# SQL Prüfung
############################################################
Write-Log "Prüfe SQL Verbindung"
#$SQLTest = Test-NetConnection `
#-ComputerName $VeeamServerName `
#-Port 1433
if (!$SQLTest.TcpTestSucceeded) {
Write-Log `
"WARNUNG: SQL Port 1433 nicht erreichbar"
}
############################################################
# LIZENZ PRÜFEN
############################################################
$UseLicenseFile = $false
if(Test-Path $LicenseSource)
{
Copy-Item `
$LicenseSource `
$LicenseTarget `
-Force
$UseLicenseFile = $true
Write-Log "Lizenzdatei gefunden: $LicenseTarget"
}
else
{
Write-Log "Keine Lizenzdatei gefunden."
Write-Log "Installation wird als Community Edition durchgeführt."
}
############################################################
# Antwortdatei kopieren
############################################################
$AnswerFile = `
"$WorkDir\VbrAnswerFile_install.xml"
Copy-Item `
$AnswerFileSource `
$AnswerFile `
-Force
############################################################
# XML bearbeiten
############################################################
Write-Log "Passe Antwortdatei an"
[xml]$XML = Get-Content $AnswerFile
foreach($Property in `
$XML.unattendedInstallationConfiguration.properties.property)
{
switch($Property.name)
{
"ACCEPT_EULA"
{
$Property.value="1"
}
"ACCEPT_LICENSING_POLICY"
{
$Property.value="1"
}
"ACCEPT_THIRDPARTY_LICENSES"
{
$Property.value="1"
}
"ACCEPT_REQUIRED_SOFTWARE"
{
$Property.value="1"
}
"VBR_LICENSE_FILE"
{
if($UseLicenseFile)
{
$Property.value=$LicenseTarget
}
else
{
$Property.value="0"
}
}
"VBR_SQLSERVER_INSTALL"
{
$Property.value="0"
}
"VBR_SQLSERVER_ENGINE"
{
$Property.value="0"
}
"VBR_SQLSERVER_SERVER"
{
$Property.value=$SQLConnection
}
"VBR_SQLSERVER_DATABASE"
{
$Property.value=$DatabaseName
}
"VBR_SQLSERVER_AUTHENTICATION"
{
$Property.value=$SQLAuthentication
}
"VBR_ENTRAID_DATABASE_INSTALL"
{
$Property.value="0"
}
"INSTALLDIR"
{
$Property.value=$InstallPath
}
"VM_CATALOGPATH"
{
$Property.value=$CatalogPath
}
"VBR_IRCACHE"
{
$Property.value=$IRCachePath
}
"VBRC_SERVICE_PORT"
{
$Property.value=$GuestCatalogPort
}
"VBR_SERVICE_PORT"
{
$Property.value=$VeeamServicePort
}
"VBR_SECURE_CONNECTIONS_PORT"
{
$Property.value=$SecureConnectionPort
}
"VBR_RESTSERVICE_PORT"
{
$Property.value=$RestServicePort
}
"REBOOT_IF_REQUIRED"
{
$Property.value=$RebootRequired
}
default
{
if($Plugins.ContainsKey($Property.name))
{
$Property.value=$Plugins[$Property.name]
}
}
}
}
$XML.Save($AnswerFile)
############################################################
# Installation
############################################################
Write-Log "Starte Veeam Installation"
$Arguments = @(
"/AnswerFile"
"`"$AnswerFile`""
"/SkipNetworkLogonErrors"
)
$Process = Start-Process `
-FilePath $VeeamInstaller `
-ArgumentList $Arguments `
-Wait `
-PassThru
############################################################
# Ergebnis
############################################################
Write-Log `
"Installer ExitCode: $($Process.ExitCode)"
switch($Process.ExitCode)
{
0
{
Write-Log `
"Installation erfolgreich"
}
3010
{
Write-Log `
"Installation erfolgreich - Neustart erforderlich"
}
default
{
Write-Log `
"Installation FEHLGESCHLAGEN"
exit $Process.ExitCode
}
}
Write-Log `
"==== Veeam Installation beendet ===="
Write-Host ""
Write-Host "Installation abgeschlossen."
Write-Host "Log:"
Write-Host "$LogDir\Install.log"