Are there any advantages against
$_.Name -notmatch ($textbox1.Text + '|\.dpx|\.LOG2|\.Net Data|vendor|install|etc.. ')
or those two you just proposed?
I've ran this against 50 machines today and only one failed because it has an exact match of
Adobe Acrobat 11
Adobe Acrobat 11 vendor
I'm not too concerned about it since Adobe Acrobat 11 is not our standard and everyone should be on the latest DC
Where -notmatch
Forum rules
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Re: Where -notmatch
Another easy way to build match patterns.
This escaped all strings and combines into a match pattern. It is up to you to decide how to specify the match.
- $apps = '.Net', 'Adobe', 'Microsoft', 'HP ', 'Intel', 'Windows SDK'
- #$apps = Get-Content appslist.txt
- $apps = $apps | ForEach-Object{ [regex]::Escape($_) }
- $patterns = $apps -join '|'
- $nametomatch -match $pattern