Version 1.2

This commit is contained in:
Madzone
2026-08-11 09:52:19 +02:00
parent 284fe02796
commit 7f2eadf99f
7 changed files with 219 additions and 4 deletions
@@ -0,0 +1,53 @@
param(
[Parameter(Mandatory)]
[ValidateSet("VMware", "HyperV", "Proxmox")]
[string]$Platform,
[Parameter(Mandatory)]
[string]$Server,
[PSCredential]$Credential,
[switch]$DryRun
)
Set-StrictMode -Version Latest
$ErrorActionPreference = "Stop"
$Root = $PSScriptRoot
$RequiredModules = @(
"Modules\Veeam\BackupJobs.psm1",
"Modules\Platforms\$Platform.psm1"
)
foreach($Module in $RequiredModules) {
Import-Module (Join-Path $Root $Module) -Force -ErrorAction Stop
}
$Configuration = Get-Content (Join-Path $Root "Config\VeeamConfig.json") -Raw | ConvertFrom-Json
if($Platform -eq "Proxmox" -and $null -eq $Credential) {
$Credential = Get-Credential -Message "Proxmox API-Token-ID und Token-Secret eingeben"
}
switch($Platform) {
"VMware" { $VirtualMachines = @(Get-VMwareInventory -Server $Server) }
"HyperV" { $VirtualMachines = @(Get-HyperVInventory -Server $Server) }
"Proxmox" { $VirtualMachines = @(Get-ProxmoxInventory -Server $Server -ApiCredential $Credential) }
}
$Schedules = New-AlphabeticalBackupSchedules `
-JobName $Configuration.BackupJob.Name `
-VirtualMachines $VirtualMachines `
-ScheduleGroups @($Configuration.BackupJob.ScheduleGroups)
[PSCustomObject]@{
Platform = $Platform
Server = $Server
DryRun = $DryRun.IsPresent
VirtualMachineCount = $VirtualMachines.Count
VirtualMachines = $VirtualMachines
Schedules = $Schedules
JobsCreated = $false
Message = "Inventar gelesen und Zeitplanentwurf erstellt. Es wurden keine Veeam-Jobs angelegt."
}