I’m working on a Pluralsight course on continuous integration and to demonstrate the process in the introduction module I made a make believe CI system in PowerShell, When a build step failed I wanted notifications, and tray notifications can be quite handy (emails as well of course).
This is how you create a tray notification in PowerShell or/and in C#. Remember to add a reference to System.Windows.Forms.
I’m using the PowerShell for Visual Studio extension to write (syntax highlighting, intellisense, debugging etc.) and execute PowerShell scripts in Visual Studio.
You can of course do the same things in Windows PowerShell ISE
$tray = New-Object System.Windows.Forms.NotifyIcon
$tray.Icon = “C:\Users\IrisDaniela\Downloads\p.ico”
$tray.BalloonTipIcon = “Error”
$tray.BalloonTipText = “Iris you broke the build!!”
$tray.BalloonTipTitle = “Build failed”
$tray.Visible = $True
– I’ll have to come back and add syntax highlighting to this later- I’m on the tram
static void Main(string args)
var tray = new NotifyIcon
Icon = new Icon(@”C:\Users\IrisDaniela\Downloads\p.ico”),
BalloonTipIcon = ToolTipIcon.Error,
BalloonTipText = “Iris your broke the build!”,
BalloonTipTitle = “Build Failed”,
Visible = true