Create a balloon notification in PowerShell

Create a balloon notification in PowerShell

Q. How can I create a balloon notification for Windows in PowerShell?

A. To create a notification in Windows use the following PowerShell as a foundation. Note you can change the type of tip icon to something such as Error and all of the other text.

[void] [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")
$objNotifyIcon = New-Object System.Windows.Forms.NotifyIcon 
$objNotifyIcon.Icon = "C:\Windows\Folder.ico"
$objNotifyIcon.BalloonTipIcon = "Warning" 
$objNotifyIcon.BalloonTipText = "Writing a notification." 
$objNotifyIcon.BalloonTipTitle = "Test Notification"
$objNotifyIcon.Visible = $True 
$objNotifyIcon.ShowBalloonTip(5000)

Below is the resulting balloon.

Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish