After making the Lun Check Script I had an issue come up when somebody decommissioned a server. The LUNs that were mapped needed to be set offline for a week, then deleted. Since the script would see if ANY LUNs (sans ones with test in the name) were offline, this triggered an alert. 

To mitigate this problem, I added a text file that the script imports and uses to exclude any LUNs with the names included in the file in their path.

To demonstrate this, here is an example text file contents:

Exclude.txt File contents:
test
al*
delta
th*

$processThis would be the full list of LUNs, for example.

$exclude = Get-Content C:\exclude.txt
$processThis = @('test','delta','alpha','this','that','and','the','other','thing')

We can try to use -notin to see how that works when excluding the contents of Exclude.txt...

$processThis | Where-Object {$_ -notin $exclude}
alpha
this
that
and
the
other
thing

Well, that worked for 'test' and 'delta', but not the wildcard entries! I need to accommodate wildcards per my team's request.  To do this I used a ForEach-Object with Where-Object nested inside of it.

$omit = $exclude | ForEach-Object{$no = $_;$processthis | Where-Object{$_ -like $no}}

Now $omit will contain the full list of items to omit.

$omit
test
alpha
delta
this
that
the
thing

And we can finally use Where-Object with -notin to finish it up.

$processThis | Where-Object {$_ -notin $omit}
and
other

I hope you found this helpful! If you know of a better way, or have any questions, let me know!

-Ginger Ninja