Improve PowerShell performance by disabling progress bars

 
 
  • Gérald Barré

Some PowerShell commands display progress bars. For example, Invoke-WebRequest shows download progress. These progress bars can slow down script execution because writing to the console takes time. If you don't need them, you can disable progress bars to improve performance. Note that PowerShell Core (7.x) handles progress bars more efficiently than Windows PowerShell (5.x), so the impact is less significant on newer versions.

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!

Follow me:
Enjoy this blog?