Search Results for

    Show / Hide Table of Contents

    Package Progress Reporting

    You can report package execution progress to the user from the package scripts with the PowerShell cmdlet Write-Progress, here is an example:

    Write-Progress -Id 217 -Activity 'Installing software' -Status "Copying files ..." -PercentComplete 50
    

    The progress ID must be set to 217 to be displayed in the UI.

    The example would display as following in the installer:

    Write Progress

    Here is complete example you can put into a package:

    $ErrorActionPreference = 'stop'
    
    function Install-Package($Context)
    {
        $Idx = 0
    
        while($Idx -lt 100)
        {
            Write-Progress -Activity 'Installing software' -Id 217 -Status "Copying files ($Idx/100) ..." -PercentComplete $Idx
    
            Start-Sleep -Milliseconds 100
            $Idx++
        }
    
        Write-Progress -Id 217 -Activity 'Installing software' -Status 'Complete' -Completed
    }
    
    In This Article
    Back to top Generated by DocFX