enhance node vm status hyperv
This commit is contained in:
parent
da823082b2
commit
7b6b9688d4
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue