lets say that you have a button that runs the code and performs some kind of task.
Example:
$buttonStart_Click={ $progressbar1.MarqueeAnimationSpeed = 5
One important thing though, if your code will perform some "heavy" tasks, most likely the form and progress panel will freeze with it until it completes the task. therefore, it makes no sense to have a bar.
A simple and lazy solution would be the following line:
[System.Windows.Forms.Application]::DoEvents()
this will unfreeze the form while the code runs the task. Check the Sapien spotlight on the panel.
source share