Files
2026-08-11 09:10:37 +02:00

26 lines
789 B
PowerShell

Set-StrictMode -Version Latest
function Get-VMwareInventory {
param([Parameter(Mandatory)][string]$Server)
foreach($Name in @("Get-VBRServer", "Find-VBRViEntity")) {
if($null -eq (Get-Command $Name -ErrorAction SilentlyContinue)) {
throw "Veeam-Befehl nicht verfügbar: $Name"
}
}
$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