git add .

git commit -m "Neue Skripte hinzugefügt"
git push
This commit is contained in:
Madzone
2026-08-06 22:40:17 +02:00
parent 4b76addbaa
commit 780f5c4cfa
13 changed files with 13913 additions and 0 deletions
+645
View File
@@ -0,0 +1,645 @@
<#
.SYNOPSIS
Dry-Run Funktionen für Veeam Enterprise Installer.
.DESCRIPTION
Simuliert Installationsschritte ohne Änderungen.
.VERSION
1.0.0
#>
Set-StrictMode -Version Latest
############################################################
# Variablen
############################################################
$Script:DryRunVersion =
"1.0.0"
$Script:DryRunEnabled =
$true
############################################################
# Get-DryRunStatus
############################################################
function Get-DryRunStatus {
<#
.SYNOPSIS
Liefert Dry-Run Status.
#>
[PSCustomObject]@{
Enabled =
$Script:DryRunEnabled
Mode =
"Simulation"
Version =
$Script:DryRunVersion
Time =
Get-Date
}
}
############################################################
# Enable-DryRunMode
############################################################
function Enable-DryRunMode {
<#
.SYNOPSIS
Aktiviert Dry-Run.
#>
$Script:DryRunEnabled =
$true
return $true
}
############################################################
# Disable-DryRunMode
############################################################
function Disable-DryRunMode {
<#
.SYNOPSIS
Deaktiviert Dry-Run.
#>
$Script:DryRunEnabled =
$false
return $true
}
#Beginn PART 2
############################################################
# Invoke-DryRunAction
############################################################
function Invoke-DryRunAction {
<#
.SYNOPSIS
Simuliert eine Aktion.
#>
param(
[Parameter(Mandatory)]
[string]$Action,
[hashtable]$Parameters
)
[PSCustomObject]@{
Action =
$Action
Parameters =
$Parameters
Executed =
$false
Mode =
"DryRun"
Message =
"Aktion wurde nur simuliert."
Time =
Get-Date
}
}
############################################################
# Test-DryRunInstallation
############################################################
function Test-DryRunInstallation {
<#
.SYNOPSIS
Simuliert Veeam Installation.
#>
param(
[string]$SourcePath,
[string]$SQLServer,
[string]$Database
)
Invoke-DryRunAction `
-Action "Install Veeam Backup & Replication" `
-Parameters @{
Source =
$SourcePath
SQLServer =
$SQLServer
Database =
$Database
}
}
############################################################
# Test-DryRunRepository
############################################################
function Test-DryRunRepository {
<#
.SYNOPSIS
Simuliert Repository Erstellung.
#>
param(
[string]$Name,
[string]$Path
)
Invoke-DryRunAction `
-Action "Create Backup Repository" `
-Parameters @{
Name =
$Name
Path =
$Path
}
}
#Beginn PART 3
############################################################
# Test-DryRunBackupJob
############################################################
function Test-DryRunBackupJob {
<#
.SYNOPSIS
Simuliert Backup Job Erstellung.
#>
param(
[string]$Name,
[string]$Repository,
[int]$RetentionDays = 14
)
Invoke-DryRunAction `
-Action "Create Backup Job" `
-Parameters @{
JobName =
$Name
Repository =
$Repository
RetentionDays =
$RetentionDays
}
}
############################################################
# Invoke-DryRunPipeline
############################################################
function Invoke-DryRunPipeline {
<#
.SYNOPSIS
Simuliert komplette Installation.
#>
param(
[Parameter(Mandatory)]
[PSCustomObject]$Configuration
)
$Results = @()
$Results +=
Test-DryRunInstallation `
-SourcePath "Simulation"
$Results +=
Test-DryRunRepository `
-Name $Configuration.RepositoryName `
-Path $Configuration.RepositoryPath
$Results +=
Test-DryRunBackupJob `
-Name $Configuration.BackupJobName `
-Repository $Configuration.RepositoryName `
-RetentionDays $Configuration.RetentionDays
return $Results
}
############################################################
# Get-DryRunReport
############################################################
function Get-DryRunReport {
<#
.SYNOPSIS
Erstellt Dry-Run Bericht.
#>
param(
[Parameter(Mandatory)]
[array]$Results
)
[PSCustomObject]@{
Mode =
"DryRun"
Actions =
$Results.Count
Details =
$Results
Created =
Get-Date
}
}
#Beginn PART 4
############################################################
# Save-DryRunReport
############################################################
function Save-DryRunReport {
<#
.SYNOPSIS
Speichert Dry-Run Bericht.
#>
param(
[Parameter(Mandatory)]
[PSCustomObject]$Report,
[string]$Path =
"C:\ProgramData\VeeamInstaller\Reports"
)
if(!(Test-Path $Path))
{
New-Item `
-Path $Path `
-ItemType Directory `
-Force |
Out-Null
}
$File =
Join-Path `
$Path `
(
"DryRun_" +
(
Get-Date `
-Format "yyyyMMdd_HHmmss"
) +
".json"
)
$Report |
ConvertTo-Json `
-Depth 10 |
Out-File `
-FilePath $File `
-Encoding UTF8
return $File
}
############################################################
# Test-DryRunConfiguration
############################################################
function Test-DryRunConfiguration {
<#
.SYNOPSIS
Prüft Dry-Run Konfiguration.
#>
param(
[Parameter(Mandatory)]
[PSCustomObject]$Configuration
)
[PSCustomObject]@{
RepositoryDefined =
(
![string]::IsNullOrWhiteSpace(
$Configuration.RepositoryPath
)
)
DatabaseDefined =
(
![string]::IsNullOrWhiteSpace(
$Configuration.Database
)
)
JobDefined =
(
![string]::IsNullOrWhiteSpace(
$Configuration.BackupJobName
)
)
Valid =
$true
Checked =
Get-Date
}
}
#Beginn PART 5
############################################################
# Export Module Functions
############################################################
Export-ModuleMember `
-Function `
Get-DryRunStatus,
Enable-DryRunMode,
Disable-DryRunMode,
Invoke-DryRunAction,
Test-DryRunInstallation,
Test-DryRunRepository,
Test-DryRunBackupJob,
Invoke-DryRunPipeline,
Get-DryRunReport,
Save-DryRunReport,
Test-DryRunConfiguration
############################################################
# Ende DryRun.psm1
############################################################