Enable progress bar in PowerShell 7
Page content
In PowerShell 7, I have noticed that on my machine the Progress bar was not showing by default. I found that annoying, so I searched for how to get it back; this was very easy in the end.
Reveiling it again
All you have to do is add this line of code to your script
$ProgressPreference = 'Continue'
Show it at the top
This line will display the progress bar again; the only difference with the previous PowerShell versions is that it now shows it inline instead of at the top of the window.
$PSStyle.Progress.View = 'Classic'
The snippet above will show it at the top of the window and is available in PowerShell 7.2.
References
- https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_preference_variables?view=powershell-7.3#progresspreference
- https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/write-progress?view=powershell-7.3
- https://learn.microsoft.com/en-us/dotnet/api/system.management.automation.psstyle.progressconfiguration?view=powershellsdk-7.3.0