title: How to run a powershell script in the background and receive a toast notification?
body: <p>The answers to <a href="https://stackoverflow.com/questions/2071496/run-a-powershell-script-in-the-background-once-per-minute">this question</a> address the first part of my question.</p>
  
  <p>Unfortunately when I schedule a job such that the powershell window is hidden, any toast notifications that my script sends are not shown.
  The script shows toast notifications using this script (<a href="https://www.kjctech.net/4-types-of-notifications-generated-in-powershell/" rel="nofollow noreferrer">source</a>):</p>
  
  <pre class="lang-bsh prettyprint-override"><code>Add-Type -AssemblyName System.Windows.Forms 
  $global:balloon = New-Object System.Windows.Forms.NotifyIcon
  $path = (Get-Process -id $pid).Path
  $balloon.Icon = [System.Drawing.Icon]::ExtractAssociatedIcon($path) 
  $balloon.BalloonTipIcon = [System.Windows.Forms.ToolTipIcon]::Warning 
  $balloon.BalloonTipText = 'What do you think of this balloon tip?'
  $balloon.BalloonTipTitle = "Attention $Env:USERNAME" 
  $balloon.Visible = $true 
  $balloon.ShowBalloonTip(5000)
  </code></pre>
  
  <p>When I schedule the powershell script in a way that it's not hidden, notifications are shown, but every time the script is triggered I briefly see a powershell window.</p>
  
  <p><strong>How can I schedule a task or job that hides the powershell window, but shows toast notifications?</strong></p>