Perform the following steps:
- First of all, remember Get-Command and the ParameterName parameter. While this is, incidentally, also a useful Filter parameter, it will help you locate cmdlets that are able to filter without using Where-Object. Use Get-Command now:
Get-Command -ParameterName *Filter*
- While using Where-Object to filter objects based on certain criteria is a popular choice, it is often the slowest choice, even for a small set of objects, as the following step shows. Try filtering for DLLs with Where-Object:
$files = Get-ChildItem -File -Recurse -Path $PSHOME | Where-Object -Property Extension -eq '.dll'(Get-History)[-1].Duration
- By simply replacing Where-Object with the Filter parameter, we can cut down the ...