MDT 2012 Powershell Progress in MDT 2012 RRS feed

  • Question

  • On the Install Operating System step it says ......

    Running Action: Install Operating System

    And then a second line saying...

    [ 84% ] Applying Progress: 30 Secs Remaining.

    I would like to know if there is a way to make progress that I have setup in a Powershell script (using Write-Progress cmdlet) to show up on the second line. 

    So if the Powershell script is written as below it will give you a progress bar of the data copy.  I would like that to be on the progress of MDT

        $path = "c:\source files"
        $dest = "C:\destination files"
        $files = Get-ChildItem $path -recurse

        [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms") | out-null;
                $counter = 1
                Foreach($file in $files)
                 $status = "Copy files {0} on {1}: {2}" -f $counter,$files.Count,$file.Name
                 Write-Progress -Activity "Copying scripts locally" $status -PercentComplete ($counter / $files.count*100)
                 $restpath = "Custom"
                Copy-Item  $file.fullname $($dest+$restpath) -Force

    Friday, March 2, 2012 3:10 PM

All replies

  • That is the default behavior of the MDT 2012 "Run PowerShell Script" task sequence action: any progress that you report via Write-Progress will be displayed in the second line of the progress dialog.  So you don't need to do anything special.

    This is the logic I use to test that functionality:

    for ($i=1; $i -le 5; $i++)
     Write-Progress -activity "Testing" -status "Percent complete: $i" -percentComplete $i
     Start-Sleep 1

    Thanks, -Michael Niehaus Senior Program Manager, Microsoft Deployment Toolkit

    Monday, March 5, 2012 6:17 AM