System tray pop-up message notifications using PowerShell


(adsbygoogle = window.adsbygoogle   []).push({}); “ class=”Adsense_Box” style=”margin: 0px; padding: 0px; word-wrap: break-word; color: rgb(0, 0, 0); font-family: Verdana, sans-serif; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(243, 247, 247); text-decoration-style: initial; text-decoration-color: initial;”>

In this post, I will show you how to get pop-up windows in System tray notification area using balloon tips and Powershell.

If you are looking for a article about how to get pop-up message box using powershell rather than balloon tip, refer to this article:

System tray notifications increase the user experience. Say I am  a Powershell script which will shutdown a server and wait for it to come online, I don’t have to keep watching the console to know if my server is up or not. Rather I would rely on some notification (email, pop-up messages, etc) to get the status so that I can work on something else while my server(s) is booting up. It sounds interesting. Isn’t it?

We can list down “n” number of use cases where System tray notifications will come handy in various scripts. I won’t list all of them here as it is impossible and I will leave it to your imagination to get your own list of use cases. However, what I will cover in this post is, the code used for generating system tray notifications using balloon tips. This post is actually inspired from today’s daily tip from They have given a basic code using which you can get balloon pop-up message. Here I will give you a sophisticated function which you can use in any script to provide different types of messages.

Function: Show-BalloonTip

function Show-BalloonTip {
[string]$MessageType = “Info”,

[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 = $MessageType
$balloon.BalloonTipText = $Message
$balloon.BalloonTipTitle = $Title
$balloon.Visible = $true


Usage instructions:

Show-BalloonTip -Title “my message” -MessageType Warning -Message “you have a warning dude” -Duration 1000

Show-BalloonTip -Title “Error occurred” -MessageType Error -Message “you have a Error dude” -Duration 1000

Sample Output:

Hope you will find this function useful. Feel free to use it in your scripts.

I welcome your comments for improvisation.