title: Msgbox in PowerShell script run from task scheduler not working
body: <p>I have a PowerShell script that creates a schedule task to launch the script. The idea is there are some task in the script that requires reboot. At the end of the PowerShell a message box should prompt the user to let the user knows that all the tasks are completed. What am i doing wrong? </p>
  
  <pre><code>Add-Type -AssemblyName PresentationFramework
  
  TaskName = "Run Agents Install Script"
  $TaskDescription = "Run Agents Install Script at logon"
  $Action = New-ScheduledTaskAction -Execute 'Powershell.exe' `
    -Argument "-executionpolicy remotesigned -File $PSScriptRoot\AgentInstall.ps1"
  $Trigger =  New-ScheduledTaskTrigger -AtLogOn
  
  Register-ScheduledTask -Action $Action -Trigger $Trigger -TaskName $TaskName -Description $TaskDescription -User "System"
  
  
  $MsgBoxInput =  [System.Windows.MessageBox]::Show('Installation completed successfully.','Agent Install','OK')
  Switch  ($MsgBoxInput) {
      'OK' 
     {
  
  $MsgBoxInput =  [System.Windows.MessageBox]::Show('WARNING! Please install Imprivata agent manually if applicable.','Agent Install','OK')
     }
  }
  </code></pre>