enhance node vm status hyperv

This commit is contained in:
qgarnier 2017-11-27 15:48:48 +01:00
parent da823082b2
commit 7b6b9688d4
1 changed files with 13 additions and 2 deletions

View File

@ -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
=cut