diff --git a/test/powershell/engine/Remoting/SSHRemotingCmdlets.Tests.ps1 b/test/powershell/engine/Remoting/SSHRemotingCmdlets.Tests.ps1 index a84186ab260..c79eb01a61b 100644 --- a/test/powershell/engine/Remoting/SSHRemotingCmdlets.Tests.ps1 +++ b/test/powershell/engine/Remoting/SSHRemotingCmdlets.Tests.ps1 @@ -55,6 +55,18 @@ Describe "SSHConnection parameter hashtable type conversions" -Tags 'Feature', ' It "" -TestCases $TestCasesSSHConnection { param($scriptBlock) - { & $scriptBlock } | Should -Throw -ErrorId '2100,PSSessionOpenFailed' + + $err = $null + try + { + & $scriptBlock + } + catch + { + $err = $_ + } + # The exact returned error id string varies depending on platform, + # but will always contain 'PSSessionOpenFailed'. + $err.FullyQualifiedErrorId | Should -Match 'PSSessionOpenFailed' } }