Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

Checking if a multi-valued object is in a collection of multi-valued objects

$
0
0

Hello

Can someone please help me with the following question

if I have a simple array like this

$A = @(1,2,3,4,5)

$B = 5

$A -contains $B
True

However if I do
$A = @(get-service)

$B = Get-service | get-random

$A -contains $B

False

I want to be able to check if a collection of multi-valued objects contains a particular multi-values object of the same type.

Thank you

AAnotherUser__


Viewing all articles
Browse latest Browse all 6937

Trending Articles