Private/Utils/Write-ProgressBar.ps1

function Write-ProgressBar {
    <#
    .SYNOPSIS
        Display standardized progress bar for long-running operations.
     
    .DESCRIPTION
        Centralized progress reporting function with consistent formatting across
        all scanning and processing operations.
     
    .PARAMETER Current
        Current item index (1-based).
     
    .PARAMETER Total
        Total number of items to process.
     
    .PARAMETER Activity
        Description of the activity being performed.
     
    .PARAMETER ItemName
        Optional name of the current item being processed.
     
    .EXAMPLE
        Write-ProgressBar -Current 5 -Total 20 -Activity "Scanning subscriptions" -ItemName "Sub-Prod"
     
    .OUTPUTS
        None - Displays progress to console
    #>

    [CmdletBinding()]
    param(
        [Parameter(Mandatory = $true)]
        [int]$Current,
        
        [Parameter(Mandatory = $true)]
        [int]$Total,
        
        [Parameter(Mandatory = $true)]
        [string]$Activity,
        
        [string]$ItemName
    )
    
    $percentComplete = [Math]::Round(($Current / $Total) * 100, 1)
    
    $status = "Processing {0}/{1}" -f $Current, $Total
    if ($ItemName) {
        $status += " - $ItemName"
    }
    
    Write-Progress `
        -Activity $Activity `
        -Status $status `
        -PercentComplete $percentComplete
}