(plugin) apps::microsoft::hyperv::2012 - try to load Hyper-V module if needed (#3525)

This commit is contained in:
qgarnier 2022-03-07 11:12:47 +01:00 committed by GitHub
parent 6251df7892
commit a2e65c1592
5 changed files with 19 additions and 0 deletions

View File

@ -40,6 +40,10 @@ $ProgressPreference = "SilentlyContinue"
Try {
$ErrorActionPreference = "Stop"
If (@(Get-Module | Where-Object {$_.Name -Match "Hyper-V"} ).count -eq 0) {
Import-Module -Name "Hyper-V"
}
$vms = Get-VM
$items = New-Object System.Collections.Generic.List[Hashtable];

View File

@ -40,6 +40,9 @@ $ProgressPreference = "SilentlyContinue"
Try {
$ErrorActionPreference = "Stop"
If (@(Get-Module | Where-Object {$_.Name -Match "Hyper-V"} ).count -eq 0) {
Import-Module -Name "Hyper-V"
}
$vms = Get-VM

View File

@ -40,6 +40,10 @@ $ProgressPreference = "SilentlyContinue"
Try {
$ErrorActionPreference = "Stop"
If (@(Get-Module | Where-Object {$_.Name -Match "Hyper-V"} ).count -eq 0) {
Import-Module -Name "Hyper-V"
}
$vms = Get-VMReplication
$items = New-Object System.Collections.Generic.List[Hashtable];

View File

@ -40,6 +40,10 @@ $ProgressPreference = "SilentlyContinue"
Try {
$ErrorActionPreference = "Stop"
If (@(Get-Module | Where-Object {$_.Name -Match "Hyper-V"} ).count -eq 0) {
Import-Module -Name "Hyper-V"
}
$vms = Get-VM
if ($vms.Length -gt 0) {
$snapshots = Get-VMSnapshot -VMName *

View File

@ -40,6 +40,10 @@ $ProgressPreference = "SilentlyContinue"
Try {
$ErrorActionPreference = "Stop"
If (@(Get-Module | Where-Object {$_.Name -Match "Hyper-V"} ).count -eq 0) {
Import-Module -Name "Hyper-V"
}
$vms = Get-VM
$node_is_clustered = 0