title: Powershell: Send a toast notification to logged user when running as Local System
body: <p>I have a script running as Local System which does some stuff, including checking if it's a user logged on,  and if yes, it runs a PowerShell snippet to show a toast notification, such as below.</p>
  
  <p>If the PS runs as current user, it works ok. If it runs as LocalSystem, the current user does not see the toast because the output is sent Session 0 (for local system account).</p>
  
  <p>Is it possible to display a toast notification to logged on user, if running as Local System and <strong>without</strong> requesting user's credentials?</p>
  
  <pre><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]::Info 
  $balloon.BalloonTipText = "$Text"
  $balloon.BalloonTipTitle = "$Title" 
  $balloon.Visible = $true 
  $balloon.ShowBalloonTip($Miliseconds)
  </code></pre>