Created
July 15, 2020 17:59
-
-
Save LawrenceHwang/94a0a7f7ef86169698286b1c52581557 to your computer and use it in GitHub Desktop.
Pre-meeting system health check using PowerShell's Pester 5.
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
Describe 'Pre-meeting Check List' { # These are a Pester 5 compliant tests. | |
Context 'Device Check' { | |
It 'Device should be present and have OK status: [<deviceName>]' -TestCases @( | |
@{deviceName = 'Blue Snowball' } | |
@{deviceName = '*TrackBall Mouse' } | |
@{deviceName = 'Microphone (Blue Snowball)' } | |
@{deviceName = 'Canon EOS 6D Mark II' } | |
) { | |
$device = (Get-PnpDevice -FriendlyName $deviceName -Status 'OK' -PresentOnly -ErrorAction SilentlyContinue) | |
$device.count | Should -BeGreaterOrEqual 1 | |
} | |
} | |
Context 'Network Check' { | |
It 'Network path should be up for: [<address>:<port>]' -TestCases @( | |
@{ | |
address = 'app.chime.aws' | |
port = 443 | |
} | |
@{ | |
address = 'www.amazon.com' | |
port = 443 | |
} | |
@{ | |
address = 'www.google.com' | |
port = 443 | |
} | |
) { | |
$t = Test-NetConnection -ComputerName $address -Port $port -ErrorAction SilentlyContinue | |
$t.TcpTestSucceeded | Should -Be $true | |
} | |
It 'Network latency should be within <latencyMin>-<latencyMax> ms for: [<address>]' -TestCases @( | |
@{ | |
address = 'app.chime.aws' | |
latencyMin = 0 # GCP - The Dalles, Oregon. Should be less than 30ms | |
latencyMax = 30 | |
} | |
@{ | |
address = 'www.amazon.com' | |
latencyMin = 0 | |
latencyMax = 30 | |
} | |
@{ | |
address = 'www.google.com' | |
latencyMin = 0 | |
latencyMax = 30 | |
} | |
) { | |
$t = (Test-NetConnection -ComputerName $address -ErrorAction SilentlyContinue).PingReplyDetails.RoundtripTime | |
$t | Should -BeGreaterThan $latencyMin | |
$t | Should -BeLessOrEqual $latencyMax | |
} | |
} | |
Context 'Processes Check' { | |
It "The process should not be running: [<name>]" -TestCases @( | |
@{name = 'chrome*' } | |
@{name = 'edge*' } | |
@{name = 'firefox*' } | |
@{name = 'outlook*' } | |
@{name = 'skype*' } | |
@{name = 'slack*' } | |
@{name = 'steam*' } | |
@{name = 'telegram*' } | |
) { | |
(Get-Process -Name $name).count | Should -Be 0 | |
} | |
It "The process should be running: [<name>]" -TestCases @( | |
@{name = 'chime*' } | |
@{name = 'code' } | |
@{name = 'obs64*' } | |
) { | |
(Get-Process -Name $name).count | Should -BeGreaterOrEqual 1 | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment