< Back

Write-MyProgress

Mon Jan 13, 2020 8:02 pm

NAME Write-MyProgress



SYNOPSIS

Displays a progress bar within a Windows PowerShell command window.





SYNTAX

Write-MyProgress [-Object] <Array> [-StartTime] <DateTime> [-Count] <Int32> [[-Id] <Int32>] [[-ParentId] <Int32>]

[<CommonParameters>]





DESCRIPTION

The Write-Progress cmdlet displays a progress bar in a Windows PowerShell command window that depicts the status

of a running command or script.





PARAMETERS

-Object <Array>

Object use in your foreach processing



Required? true

Position? 1

Default value

Accept pipeline input? false

Accept wildcard characters? false



-StartTime <DateTime>

StartTime of the foreach processing



Required? true

Position? 2

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Count <Int32>

Foreach Count status



Required? true

Position? 3

Default value 0

Accept pipeline input? false

Accept wildcard characters? false



-Id <Int32>

Specifies an ID that distinguishes each progress bar from the others.



Required? false

Position? 4

Default value 1

Accept pipeline input? false

Accept wildcard characters? false



-ParentId <Int32>

Specifies the parent activity of the current activity.



Required? false

Position? 5

Default value -1

Accept pipeline input? false

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS



OUTPUTS



NOTES





File Name : Write-MyProgress.ps1

Author : Thomas ILLIET, contact@thomas-illiet.fr

Date : 2017-05-10

Last Update : 2018-01-08

Version : 1.0.1



-------------------------- EXAMPLE 1 --------------------------



PS C:\\>$GetProcess = Get-Process



$Count = 0

$StartTime = Get-Date

foreach($Process in $GetProcess)

{

$Count++

Write-MyProgress -StartTime $StartTime -Object $GetProcess -Count $Count

write-host "-> $($Process.ProcessName)"

Start-Sleep -Seconds 1

}











RELATED LINKS