I am updating my Get-ExchangeServerPlus.ps1 and I wanted to check for a hotfix in the registry. But I wanted the ability to add more checks by adding a value to an array.
So my code is enumerating the registry using WMI and I wanted to check a registry key against my array. I was thinking about for loops and then found this .. damm cool!
$arrColors = "blue", "red", "green", "yellow", "white", "pink", "orange", "turquoise"
$arrColors –contains "black"
Believe it or not, that’s all there is to it: all we have to do is use the –contains operator, followed by the value we’re searching for. As you might have guessed, the –contains operator tells us whether or not an item can be found in a group. Because the color black does not appear in our array, PowerShell is going to respond by telling us this