Version 1.2
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
Set-StrictMode -Version Latest
|
||||
|
||||
function Get-HyperVInventory {
|
||||
param([Parameter(Mandatory)][string]$Server)
|
||||
|
||||
foreach($Command in @("Get-VBRServer", "Find-VBRHvEntity")) {
|
||||
if($null -eq (Get-Command $Command -ErrorAction SilentlyContinue)) {
|
||||
throw "Veeam-Befehl nicht verfügbar: $Command"
|
||||
}
|
||||
}
|
||||
|
||||
$VBRServer = Get-VBRServer -Name $Server | Where-Object { $_.Type -in @("HvServer", "HvCluster", "Scvmm") } | Select-Object -First 1
|
||||
if($null -eq $VBRServer) {
|
||||
throw "Hyper-V-Server ist in Veeam nicht registriert: $Server"
|
||||
}
|
||||
|
||||
@(Find-VBRHvEntity -Server $VBRServer -HostsAndVMs | Where-Object { $_.Type -match "Vm" } | Select-Object -ExpandProperty Name -Unique)
|
||||
}
|
||||
|
||||
Export-ModuleMember -Function Get-HyperVInventory
|
||||
@@ -0,0 +1,23 @@
|
||||
Set-StrictMode -Version Latest
|
||||
|
||||
function Get-ProxmoxInventory {
|
||||
param(
|
||||
[Parameter(Mandatory)][string]$Server,
|
||||
[Parameter(Mandatory)][PSCredential]$ApiCredential
|
||||
)
|
||||
|
||||
$TokenSecret = $ApiCredential.GetNetworkCredential().Password
|
||||
$Headers = @{ Authorization = "PVEAPIToken=$($ApiCredential.UserName)=$TokenSecret" }
|
||||
$Uri = "https://$Server`:8006/api2/json/cluster/resources?type=vm"
|
||||
|
||||
try {
|
||||
$Response = Invoke-RestMethod -Method Get -Uri $Uri -Headers $Headers -ErrorAction Stop
|
||||
@($Response.data | Where-Object { $_.type -eq "qemu" } | Select-Object -ExpandProperty name -Unique)
|
||||
}
|
||||
finally {
|
||||
$TokenSecret = $null
|
||||
$Headers = $null
|
||||
}
|
||||
}
|
||||
|
||||
Export-ModuleMember -Function Get-ProxmoxInventory
|
||||
@@ -0,0 +1,20 @@
|
||||
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
|
||||
Reference in New Issue
Block a user