Private/Helper/Write-IntegrisProgressBar.ps1

<#
Copyright © 2024 Integris. For internal company use only. All rights reserved.
#>


FUNCTION Write-IntegrisProgressBar {

    <#
    .SYNOPSIS
    Write a Progress Bar in the Integris unofficial standard format.
 
    .DESCRIPTION
    Write a Progress Bar in the Integris unofficial standard format.
     
    .PARAMETER TotalCount
    The total of number of items in the process.
 
    .PARAMETER CurrentCount
    The current item number in the process.
 
    .PARAMETER Activity
    The activity text to show on the progress bar.
 
    .PARAMETER Status
    The status text to show on the progress bar.
 
    .PARAMETER ID
    The ID number for the progress bar.
 
    .PARAMETER PercentageDecimalPlaces
    The number of decimal places for the percentage bar. Default is 0.
     
    .EXAMPLE
    Write-IntegrisProgressBar -TotalCount $TotalCount -CurrentCount $CurrentCount -Activity "Performing SPF Checks" -Status "Checking $Domain SPF for $Address" -ID 20938402
    #>


    [CmdletBinding()]
    PARAM (
        [Parameter(Mandatory)]
        [INT]$TotalCount,
        [Parameter(Mandatory)]
        [INT]$CurrentCount,
        [Parameter(Mandatory)]
        [STRING]$Activity,
        [Parameter(Mandatory)]
        [STRING]$Status,
        [Parameter(Mandatory)]
        $ID,
        [INT]$PercentageDecimalPlaces = 0
    )

    $PercentComplete = [math]::round($CurrentCount / $TotalCount * 100, $PercentageDecimalPlaces)

    Write-Progress -ID $ID -Activity "$Activity.." -Status "$PercentComplete% - $Status - $CurrentCount of $TotalCount" -PercentComplete $PercentComplete
}