Files
2026-08-11 09:52:19 +02:00

21 lines
762 B
PowerShell

Set-StrictMode -Version Latest
function Get-VMwareInventory {
param([Parameter(Mandatory)][string]$Server)
foreach($Command in @("Get-VBRServer", "Find-VBRViEntity")) {
if($null -eq (Get-Command $Command -ErrorAction SilentlyContinue)) {
throw "Veeam-Befehl nicht verfügbar: $Command"
}
}
$VBRServer = Get-VBRServer -Name $Server | Where-Object { $_.Type -in @("VC", "ESXi", "ESX") } | Select-Object -First 1
if($null -eq $VBRServer) {
throw "VMware-Server ist in Veeam nicht registriert: $Server"
}
@(Find-VBRViEntity -Server $VBRServer -VMsAndTemplates | Where-Object { $_.Type -match "Vm" } | Select-Object -ExpandProperty Name -Unique)
}
Export-ModuleMember -Function Get-VMwareInventory