≡ Menu

System tray pop-up message notifications using PowerShell

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: https://techibee.com/powershell/how-to-get-pop-up-message-box-using-powershell/839

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 http://powershell.com. 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.

Comments on this entry are closed.

  • Matt October 26, 2012, 9:34 am

    How would you push these to remote machines on the same domain?

  • SV January 5, 2013, 3:48 pm

    I love the code and is almost exactly what I need. its seems that it leaves the icon in the tray and after each balloon pop up, leaves another. How would you keep this clean each time? I have some long running scripts that would benefit from this cmdlet.


    • PeterBot February 28, 2013, 5:29 am


      • Scott March 26, 2013, 2:44 am

        Where does $balloon.dispose() go?

        • Steve February 8, 2014, 5:48 pm

          After the $balloon.ShowBalloonTip() method is called:

          Start-Sleep -Milliseconds $Duration

          Start-Sleep is needed so as not to dispose of the object too quickly. Unfortunately this also blocks the function.

  • Tom Purl January 28, 2013, 8:56 pm

    This is a fantastic tip. I’m using this function with a countdown timer, and it’s super-useful.

  • Aaron U'Ren February 26, 2013, 3:26 am

    This is a great article! Thanks for taking the time to write this up it saved me a lot of time and was exactly what I was looking for!

  • Pankaj August 11, 2015, 11:09 pm

    How can we increase duration, Setting Duration is not impacting , balloon is getting disappear after few sec only.

    • TechiBee August 23, 2015, 8:57 pm

      Duration is in milliseconds. Make sure to pass the number accordingly. 20000 is the value if you want to have the pop-up for 20 seconds.

  • Praveen August 31, 2016, 12:18 pm

    Thank you

  • scott November 4, 2016, 11:26 pm

    is there a way to change the size of the notification bubble itself? I was looking to change the size of the password expiration bubble for our users.

    • Wintel Rocks December 15, 2016, 8:31 pm

      Hi, I haven’t come across any approach that can change the bubble size. This seems windows default.

  • Matthew Wai November 29, 2016, 7:30 pm

    I have saved the script in a .ps1 file, but nothing happens when I run it.

    • Wintel Rocks December 11, 2016, 7:43 pm


      Copy paste the code into powershell window and try the usage instructions mentioned in the blog. Let me know if it still fails.

  • Raouf March 14, 2017, 8:23 pm

    Hi everyone,

    How would you push these to remote machines on the same domain?
    i would like to use that function to notify users

    thks for the script

    • Wintel Rocks April 9, 2017, 7:28 pm

      Sending pop-ups to remote machines is tricky as this is interactive behaviour. Let me test and post a new article about it.

      • poorman June 23, 2017, 5:23 am

        I’m interested in ending to remote machines on a domain as well. Have you made any progress? I do know it is difficult because remote processes are usually put into another user space even if the credentials are the same.

        • poorman June 23, 2017, 5:24 am

          sending not ending, lol

          • Wintel Rocks June 27, 2017, 2:06 pm

            No solution is developed for this requirement. However it is possible. I have seen many people asking for this information. Stay tuned for it. I will make a post on it soon.

  • poorman July 13, 2017, 9:31 pm

    I have been trying a few things too but unable to have it run in the logged on user session on the remote system. I sincerely hope you are making better progress.

  • nice February 16, 2020, 7:20 pm

    Nice program