diff --git a/centreon-plugins/centreon/common/powershell/hyperv/2012/nodevmstatus.pm b/centreon-plugins/centreon/common/powershell/hyperv/2012/nodevmstatus.pm index 23ac2ced5..478c46fa3 100644 --- a/centreon-plugins/centreon/common/powershell/hyperv/2012/nodevmstatus.pm +++ b/centreon-plugins/centreon/common/powershell/hyperv/2012/nodevmstatus.pm @@ -39,10 +39,21 @@ Try { $ErrorActionPreference = "Stop" $vms = Get-VM + $node_is_clustered = 0 + Try { + If (@(Get-ClusterNode -ea Ignore).Count -ne 0) { + $node_is_clustered = 1 + } + } Catch { + } Foreach ($vm in $vms) { $note = $vm.Notes -replace "\r","" $note = $note -replace "\n"," - " - Write-Host "[name=" $vm.VMName "][state=" $vm.State "][status=" $vm.Status "][IsClustered=" $vm.IsClustered "][note=" $note "]" + $isClustered = $vm.IsClustered + if ($node_is_clustered == 0) { + $isClustered = "nodeNotClustered" + } + Write-Host "[name=" $vm.VMName "][state=" $vm.State "][status=" $vm.Status "][IsClustered=" $isClustered "][note=" $note "]" } } Catch { Write-Host $Error[0].Exception @@ -63,4 +74,4 @@ __END__ Method to get hyper-v informations. -=cut \ No newline at end of file +=cut