Skip to content

Instantly share code, notes, and snippets.

@lansalot
Last active October 14, 2021 11:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lansalot/922220a1bde10b0d024cf7510d3f87c6 to your computer and use it in GitHub Desktop.
Save lansalot/922220a1bde10b0d024cf7510d3f87c6 to your computer and use it in GitHub Desktop.
$PoolStatus = Get-AzWvdSessionHost -HostPoolName $HostPool -ResourceGroupName $ResourceGroup
If ((($PoolStatus | Where { $_.Status -ne 'Available' }).Count -gt 1) -or (($PoolStatus | Where { -not $_.AllowNewSession }).Count -gt 1)) {
# OK, more than 1 machine in the pool is either unavailable or not allowing new sessions
$Summary = "Unhealthy WVD pool members"
$InitialDescription = "It appears that not all machines are as they should be. Please investigate"
$InitialDescription += $PoolStatus | Select name , status , lastupdatetime, allownewsession | ft -auto | Out-String
$TeamsID = "https://yourteamswebhooketcetc.webhook.uks.azure-automation.net/webhooks?token=xxxyyy"
Send-TeamsMessage {
New-TeamsSection -ActivityTitle $Summary -ActivitySubtitle "All done" `
-ActivityImageLink "https://somewhere/warning.png" `
-ActivityText $InitialDescription | Out-String
} -Uri $TeamsID -Color DarkSeaGreen -MessageSummary 'none'
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment