Progress record in 10 minutes PowerShell

Hi everyone, is there a way to show the progress bar for 10 minutes, when the percentage statistics are complete, how much time is left for 10 minutes? using Write-Progress.

+4
source share
1 answer

If I understand the question correctly, the goal is to show some additional information in progress reports. This can be done, for example, using Activity . The following script is just an idea (within 1 minute, for a shorter test). It must be modified to reflect the truly necessary message format and information to be displayed.

 $time = 60 # seconds, use you actual time in here foreach($i in (1..$time)) { $percentage = $i / $time $remaining = New-TimeSpan -Seconds ($time - $i) $message = "{0:p0} complete, remaining time {1}" -f $percentage, $remaining Write-Progress -Activity $message -PercentComplete ($percentage * 100) Start-Sleep 1 } 

Progress is as follows:

 57 % complete, remaining time 00:00:26 Processing [oooooooooooooooooooooooooooooooooooooooooooooooooooooo 
+5
source

Source: https://habr.com/ru/post/1445359/


All Articles