Improve PowerShell performance by disabling progress bars
Some commands in PowerShell display progress bars. For instance, Invoke-WebRequest
displays the download progression. These progress bars can slow down the execution of the commands as writing to the console takes time. If you don't need the progress bars, you can disable them to improve the performance of your scripts. Note that recent versions of PowerShell Core (7.x) have a better performance than Windows PowerShell (5.x) and the progress bars are less of an issue.
PowerShell
# Disable progress bars
$ProgressPreference = 'SilentlyContinue'
# Download a 100MB file
Invoke-WebRequest -Uri '"https://speed.cloudflare.com/__down?bytes=100000000'
Do you have a question or a suggestion about this post? Contact me!
Enjoy this blog?💖 Sponsor on GitHub