How it works...
This is relatively simple to understand. We use a simple comparison operation to exclude those elements that we don't want, and then assign the resultant array back to the original array. This is the first way of doing it.
The other, not-so-simple, way of performing deletions is using the .NET class, System.Collections.Arraylist. This class has methods specific to array operations. Therefore, in some situations, the Remove() method may seem like a better option to use rather than performing filtration on the array. It is noteworthy that these methods may show undesirable console output. This is because the methods were created with programming in mind; these are neither native to PowerShell, nor entirely meant for administration. ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access