Implementing the Progress Bar: Using the Write-Progress
cmdlet in PowerShell, you can easily integrate a progress bar into your scripts. Here’s a simple example:
$Count = 1
$Total = $OrdinateurClient.Rows.Count
foreach ($OrdinateurIP in $OrdinateurClient) {
Write-Progress -Activity "Processing " -status "Computers : $Count / $Total" -PercentComplete ($Count / $Total * 100) -Id 1
$Count += 1
$Nom = $OrdinateurIP."DISPLAYNAME"
}
}
Write-Progress -Activity 'Processing' -Completed -Id 1
0 Comments