SingAbout Martin
asked on
Powershell: Combining a where statement with contains
I have a Powershell script where I'm using the following:
The above snippet works, however when I add multiple values to $Company (like below) it doesn't work anymore.
So I tried something like this:
$CompanyList = 'Contoso'
Where {$_.Company -eq $CompanyList}
The above snippet works, however when I add multiple values to $Company (like below) it doesn't work anymore.
$CompanyList = 'Contoso','Adatum','Test'
So I tried something like this:
Where {$_.Company.Contains($CompanyList)}
But this also doesn't work. Any ideas how to make the Where statement which is only True if the Company value matches one of the strings in the $CompanyList variable?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER