Windows 10 Toast notification - image not working RRS feed

  • Question

  • Hello 

    I'm trying to create toast notification with image inline using PowerShell

    based on script I found on TechNet gallery I'm executing something like this:

    $app = '{1AC14E77-02E7-4E5D-B744-2EB1AE5198B7}\WindowsPowerShell\v1.0\PowerShell.exe'
    [Windows.UI.Notifications.ToastNotificationManager, Windows.UI.Notifications, ContentType = WindowsRuntime]
    $Template = [Windows.UI.Notifications.ToastTemplateType]::ToastImageAndText01
    #Gets the Template XML so we can manipulate the values
    [xml]$ToastTemplate = ([Windows.UI.Notifications.ToastNotificationManager]::GetTemplateContent($Template).GetXml())
    [xml]$ToastTemplate = @"
    <toast launch="app-defined-string">
        <binding template="ToastGeneric">
          <text>test notification </text>
          <text>Did you know you can use Toast notifications</text>
          <Image src="https://www.windowslatest.com/wp-content/uploads/2018/01/Microsoft-Office-1.jpg" />      
    $ToastXml = New-Object -TypeName Windows.Data.Xml.Dom.XmlDocument
    $notify = [Windows.UI.Notifications.ToastNotificationManager]::CreateToastNotifier($app)

    based on this article:


    xml looks ok, unless i'm missing something. I tried different links to images, images are accessible from systems i'm trying  this. I tried this on different builds as well.

    additional question:, how to use "ms-appdata:///" to point to local file ? The file:/// method was removed unfortunately

    kind regards


    • Moved by Bill_Stewart Monday, December 17, 2018 6:38 PM This is not "research things for me" forum
    Thursday, October 4, 2018 8:48 AM

All replies

  • The code and XML used are intended to run from a "Store" app and will not work from a "Desktop" app.

    UWP application APIs are not allowed access to folders and files on the local system.  The SRC needs to point to a URL on the source service.

    ms-adddata can only point to "local","temp" or "roaming"

    See UWP documentation for how to use this API.


    Thursday, October 4, 2018 9:39 AM
  • thanks for quick response,

    this works , it is not picking app the image, but it is showing notification. Based on you response this is pure coincident and it shouldn't ? 

    I was looking in this documentation already, it is not easy to translate this to PowerShell scripting, not sure if this is possible?

    Thursday, October 4, 2018 10:49 AM
  • To access local files you must be running the code froma  packaged app.  PowerShell is not a "packaged" app (appPackage).  It can execute the toast but many of the features will not be available.

    Read through the following and the referenced links to get an idea of how this is intended to work.


    To use simple notification from PS use "NotifyIcon".  Look in Gallery for examples.


    Thursday, October 4, 2018 10:56 AM