Some short PowerShell tips #3
We left off with tip 3, using group-object. This tip is about the PowerShell version. Did you know every version of PowerShell gets lots of performance optimizations? So my tip for now: try out different PowerShell versions! At the time of writing, PowerShell 5.1 Desktop is installed on Windows 10, and the latest stable is 6.2.3 Core. And last week release candidate 2 for PowerShell 7.0.0 Core is released. The nice thing is you can run them side by side on your system! Grab them from here: https://github.com/PowerShell/PowerShell.
Besides all the new cmdlets, you also get some great performance improvements. Taking the script from tip 3 we can make our scripts run even faster!!! Your results can vary of course, but mine was very promising:
| PSVersion|| If|| Where|| Group|| AdvGroup|
| Desktop 5.1.17134.858|| 835.3|| 6,885.3|| 318.6|| 140.0|
| Core 6.2.3|| 909.6|| 336.9|| 184.6|| 136.7|
| Core 7.0.0-rc.1|| 909.6|| 290.8|| 160.6|| 106.2|
So yeah, try out different versions of PowerShell! And to see which version you use, check the $PSVersionTable variable.