Instantly share code, notes, and snippets.

Embed
What would you like to do?
Powershell Progress Notification with psInlineProgress and Burnt Toast. Associated blog post is located here https://blog.darrenjrobinson.com/powershell-progress-notifications-that-work-in-visual-studio-code-on-window-10/
# $idnObjects is a collection of thousands of identities being processed.
# Progress for Burnt
[decimal] $progress = $i / $idnObjects.count
# Percentage for psInlineProgress
$percentComplete = $i / $idnObjects.count * 100
# Round to 3 decimal places so we can update every percent of progress
$progressDisplay = [math]::Round($progress,3)
if ([math]::Floor($percentComplete) -gt $statusupdate) {
$statusupdate = [math]::Floor($percentComplete)
# display progress with psInlineProgress
Write-InlineProgress -Activity "Getting User Object $($obj.displayName)" -PercentComplete $percentComplete -ProgressCharacter '<' -ProgressFillCharacter '.' -ProgressFill '-'
# display progress with Burnt Toast
$ProgressBar = New-BTProgressBar -Status 'Getting User Objects' -Value $progressDisplay
New-BurntToastNotification –Text ‘IdentityNow Source Import’ -ProgressBar $ProgressBar -Silent –UniqueIdentifier 'Get Users' -AppLogo "C:\Users\DarrenJRobinson\Images\sailpoint.png"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment