Skip to content

Instantly share code, notes, and snippets.

@darrenjrobinson
Last active November 18, 2018 22:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save darrenjrobinson/afd88b2ea1ab0fed26290aee0411f649 to your computer and use it in GitHub Desktop.
Save darrenjrobinson/afd88b2ea1ab0fed26290aee0411f649 to your computer and use it in GitHub Desktop.
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