Sep 282011

PowerTip of the Day, from

Displaying Balloon Tip

Let’s assume your script wants to share status information via a balloon
message in the system tray area. Here is a sample:

[system.Reflection.Assembly]::LoadWithPartialName(‘System.Windows.Forms’) | Out-Null
$balloon = New-Object System.Windows.Forms.NotifyIcon
$path = Get-Process -id $pid | Select-Object -ExpandProperty Path
$icon = [System.Drawing.Icon]::ExtractAssociatedIcon($path)
$balloon.Icon = $icon
$balloon.BalloonTipIcon = ‘Info’
$balloon.BalloonTipText = ‘Completed Operation’
$balloon.BalloonTipTitle = ‘Done’
$balloon.Visible = $true

Note that the code uses the icon of your PowerShell application inside the
tray area so the user can associate the message with the application that
produced it.