fbpx Provide Progress Updates on Long-Running Tasks in PowerShell | Windows PowerShell, Windows Server | HostingUltraso.com
24/7/365 Support

Provide Progress Updates on Long-Running Tasks in PowerShell

Problem

You want to display status information to the user for longrunning tasks.

Solution

To provide status updates, use the WriteProgress cmdlet as shown in Example 125.

Example 125. Using the WriteProgress cmdlet to display status updates

$activity = "A longrunning operation"

$status = "Initializing" ## Initialize the longrunning operation for($counter = 0; $counter lt 100; $counter++) {

$currentOperation = "Initializing item $counter" WriteProgress $activity $status PercentComplete $counter ` CurrentOperation $currentOperation StartSleep m 20 }

$status = "Running" ## Initialize the longrunning operation for($counter = 0; $counter lt 100; $counter++) {

$currentOperation = "Running task $counter" WriteProgress $activity $status PercentComplete $counter ` CurrentOperation $currentOperation StartSleep m 20 }

Help Category:

Get Windows Dedicated Server

Only reading will not help you, you have to practice it! So get it now.

Processor RAM Storage Server Detail
Intel Atom C2350 1.7 GHz 2c/2t 4 GB DDR3 1× 1 TB (HDD SATA) Configure Server
Intel Atom C2350 1.7 GHz 2c/2t 4 GB DDR3 1× 128 GB (SSD SATA) Configure Server
Intel Atom C2750 2.4 GHz 8c/8t 8 GB DDR3 1× 1 TB (HDD SATA) Configure Server
Intel Xeon E3-1230 v2 3.3 GHz 4c/8t 16 GB DDR3 1× 256 GB (SSD SATA) Configure Server
Intel Atom C2350 1.7 GHz 2c/2t 4 GB DDR3 1× 250 GB (SSD SATA) Configure Server

What Our Clients Say