Geeks With Blogs
Reidar Husmo SharePoint from the trenches

Creating nested progress dialogs in Powershell is easy.

Let the code speak for itself:

for ($i = 1; $i -le 2; $i++)

{

    Write-Progress -ID 1 -Activity "Outer loop" -Status "Tick $i" -percentComplete ($i / 2*100)

    for ($j = 1; $j -le 3; $j++)

    {

        Write-Progress -ID 2 -Activity "Mid loop" -Status "Tick $j" -percentComplete ($j / 3*100)

        for ($k = 1; $k -le 3; $k++)

        {

            Write-Progress -ID 3 -Activity "Inner loop" -Status "Tick $k" -percentComplete ($k / 3*100)

            Sleep(1)

        }

    }

}

I.e. some text that explains what we're doing (Activity and Status), and ID numbers.

Easy.

Powershell ISE:

ProgressDialog

And in the console window:

ProgressShell

Posted on Wednesday, April 11, 2012 1:21 PM Powershell | Back to top


Comments on this post: Powershell progress dialogs

No comments posted yet.
Your comment:
 (will show your gravatar)


Copyright © Norgean | Powered by: GeeksWithBlogs.net