D B
asked on
Ignore Items in a List/Array
I have the following line of code:
if ($IsSysObj -ne $true -and $table.FakeSystemTable -ne $true -and $table.Name -ne "ignore_me")
{...}
I want to create an array of table names and replace '-and $table.Name -ne "ignore_me"' with code that will ignore values in that list. Not exactly sure how to accomplish this.
I know how to create the array ($a = "table1", "table2", "table3"...) but what code would I use to exclude values within the array?
if ($IsSysObj -ne $true -and $table.FakeSystemTable -ne $true -and $table.Name -ne "ignore_me")
{...}
I want to create an array of table names and replace '-and $table.Name -ne "ignore_me"' with code that will ignore values in that list. Not exactly sure how to accomplish this.
I know how to create the array ($a = "table1", "table2", "table3"...) but what code would I use to exclude values within the array?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Works like a champ. Thanks!
do a foreach on your array then do a match on the value and use if /else:
E.g.:
Open in new window