Creating Balloon Tips using PowerShell

During my presentation at the Dogfood Conference in Columbus Ohio this morning, there was a lot of interest about the balloon tips that popped up during my script execution. I thought I would do a quick post to share this, as I recently saw it on my daily PowerTip email and loved it enough to incorporate it into my “Build Your SharePoint Internet Presence with PowerShell” demonstration.

It’s pretty much as simple as creating a new System.Windows.Forms.NotifyIcon object and then setting some properties and calling the ShowBalloonTip() method.

Here’s my version of it, which I created as a function so I could call it like a Cmdlet:

function New-BalloonTip {
$TipText='This is the body text.',
$TipTitle='This is the title.',
[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 = $TipText
$balloon.BalloonTipTitle = $TipTitle
$balloon.Visible = $true

Here’s how you run it:

New-BalloonTip -TipTitle "This is the title" -TipText "This is my custom message"

And here’s what it looks like:


2 thoughts on “Creating Balloon Tips using PowerShell

Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s