diff --git a/centreon-plugins/centreon/common/powershell/hyperv/2012/listnodevms.pm b/centreon-plugins/centreon/common/powershell/hyperv/2012/listnodevms.pm index 9d0512700..46f05afc4 100644 --- a/centreon-plugins/centreon/common/powershell/hyperv/2012/listnodevms.pm +++ b/centreon-plugins/centreon/common/powershell/hyperv/2012/listnodevms.pm @@ -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]; diff --git a/centreon-plugins/centreon/common/powershell/hyperv/2012/nodeintegrationservice.pm b/centreon-plugins/centreon/common/powershell/hyperv/2012/nodeintegrationservice.pm index 395f11002..d06d7f91a 100644 --- a/centreon-plugins/centreon/common/powershell/hyperv/2012/nodeintegrationservice.pm +++ b/centreon-plugins/centreon/common/powershell/hyperv/2012/nodeintegrationservice.pm @@ -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 diff --git a/centreon-plugins/centreon/common/powershell/hyperv/2012/nodereplication.pm b/centreon-plugins/centreon/common/powershell/hyperv/2012/nodereplication.pm index bf3719e87..5a6d38942 100644 --- a/centreon-plugins/centreon/common/powershell/hyperv/2012/nodereplication.pm +++ b/centreon-plugins/centreon/common/powershell/hyperv/2012/nodereplication.pm @@ -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]; diff --git a/centreon-plugins/centreon/common/powershell/hyperv/2012/nodesnapshot.pm b/centreon-plugins/centreon/common/powershell/hyperv/2012/nodesnapshot.pm index 7a1f7dcac..5a3a3bf88 100644 --- a/centreon-plugins/centreon/common/powershell/hyperv/2012/nodesnapshot.pm +++ b/centreon-plugins/centreon/common/powershell/hyperv/2012/nodesnapshot.pm @@ -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 * diff --git a/centreon-plugins/centreon/common/powershell/hyperv/2012/nodevmstatus.pm b/centreon-plugins/centreon/common/powershell/hyperv/2012/nodevmstatus.pm index 57e93083b..6fc96a56c 100644 --- a/centreon-plugins/centreon/common/powershell/hyperv/2012/nodevmstatus.pm +++ b/centreon-plugins/centreon/common/powershell/hyperv/2012/nodevmstatus.pm @@ -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