diff --git a/test/powershell/Modules/Microsoft.PowerShell.Utility/Invoke-Item.Tests.ps1 b/test/powershell/Modules/Microsoft.PowerShell.Utility/Invoke-Item.Tests.ps1 index e63f7d633..4c8f47a44 100644 --- a/test/powershell/Modules/Microsoft.PowerShell.Utility/Invoke-Item.Tests.ps1 +++ b/test/powershell/Modules/Microsoft.PowerShell.Utility/Invoke-Item.Tests.ps1 @@ -53,7 +53,8 @@ Describe "Invoke-Item basic tests" -Tags "Feature" { } It "Should invoke an executable file without error" { - $ping = Get-Command "ping" -CommandType Application | ForEach-Object Source + # In case there is a couple of ping executables, we take the first one. + $ping = (Get-Command "ping" -CommandType Application | Select-Object -First 1).Source $redirectFile = Join-Path -Path $TestDrive -ChildPath "redirect2.txt" if ($IsWindows) {