Hi,
Thanks for your question.
You can use PowerShell operator “-contain/-notcontain” or “-in/-notin” to judge Whether in the result.
-contains:
Returns true when reference value contained in a collection
-notcontains: Returns true when reference value not contained in a collection
-in: Returns true when test value contained in a collection
-notin: Returns true when test value not contained in a collection
Please refer the link below:
https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_comparison_operators?view=powershell-6
You can use -first and -skip and “Sort-Object” cmdlet to get the second highest number.
For example:
$abc=@(1..15)
$abc| Sort-Object -Descending | select -First 1 -Skip 1
Best Regards,
Lee
Just do it.