Show-Notification
Shows a notification
param([string]$text = "Hello World", [string]$title = "NOTE", [int]$duration = 5000)
try {
Add-Type -AssemblyName System.Windows.Forms
$global:balloon = New-Object System.Windows.Forms.NotifyIcon
$path = (Get-Process -id $pid).Path
$balloon.Icon = [System.Drawing.Icon]::ExtractAssociatedIcon($path)
$balloon.BalloonTipIcon = [System.Windows.Forms.ToolTipIcon]::Info
$balloon.BalloonTipText = $text
$balloon.BalloonTipTitle = $title
$balloon.Visible = $true
$balloon.ShowBalloonTip($duration)
exit 0 # success
} catch {
"?? ERROR: $($Error[0]) (script line $($_.InvocationInfo.ScriptLineNumber))"
exit 1
}Specifies the text to show ('Hello World' by default)
Specifies the title to show ('NOTE' by default)
Specifies the view duration in milliseconds (5000 by default)