Created
March 16, 2021 18:22
-
-
Save fitzgeraldsteele/a937cb74e254a04e1f1960c00a30de40 to your computer and use it in GitHub Desktop.
Find all unhealth instances in a VMSS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$allInstances = Get-AzVmssVM -InstanceView -ResourceGroupName $rg -VMScaleSetName $vmssName | |
$unhealthyInstances = $allInstances | where {$_.InstanceView.VmHealth.Status.Code -eq "HealthState/unhealthy"} | |
Write-Output "Total instances: $($allInstances.Count)" | |
Write-Output "Unhealthy instances: $($unhealthyInstances.Count)" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment