WIndows 10 Toast Notification Deployment using MECM

Kedar Tamboli 171 Reputation points
2021-08-25T13:02:28.107+00:00

Hello All,

I am exploring to deploy Windows 10 Toast Notification from MECM (Configuration Manager)

Below is my sample toast PowerShell Script; which is working fine if I run it manually on system. However not running from MECM as Package Deployment.

-------------------------------------------Toast_PS_Script-------------------------------------------------

Specify Launcher App ID

$LauncherID = "{1AC14E77-02E7-4E5D-B744-2EB1AE5198B7}\WindowsPowerShell\v1.0\powershell.exe"

Load Assemblies

[Windows.UI.Notifications.ToastNotificationManager, Windows.UI.Notifications, ContentType = WindowsRuntime] | Out-Null
[Windows.Data.Xml.Dom.XmlDocument, Windows.Data.Xml.Dom.XmlDocument, ContentType = WindowsRuntime] | Out-Null

Build XML Template

[xml]$ToastTemplate = @"
<toast>
<visual>
<binding template="ToastImageAndText03">
<text id="1">My First Notification</text>
<text id="2">I am so excited I sent you this Kedar</text>
</binding>
</visual>
</toast>
"@

Prepare XML

$ToastXml = [Windows.Data.Xml.Dom.XmlDocument]::New()
$ToastXml.LoadXml($ToastTemplate.OuterXml)

Prepare and Create Toast

$ToastMessage = [Windows.UI.Notifications.ToastNotification]::New($ToastXML)

-----------------------------------------------------------------------------------------------------------------------------

I have created package and program to deploy it as suggested in the below article:

https://byteben.com/bb/deploy-service-announcement-toast-notifications-in-windows-10-with-memcm/

However its failing with Program exit code -196608

Program Command is as: powershell.exe -ExecutionPolicy Bypass -File “Sample_Text_Toast.ps1

Please suggest where I am missing...Thanks in advance!

Regards,
Kedar

Windows 10
Windows 10
A Microsoft operating system that runs on personal computers and tablets.
11,472 questions
Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,509 questions
Microsoft Configuration Manager Application
Microsoft Configuration Manager Application
Microsoft Configuration Manager: An integrated solution for for managing large groups of personal computers and servers.Application: A computer program designed to carry out a specific task other than one relating to the operation of the computer itself, typically to be used by end users.
481 questions
Microsoft Configuration Manager
0 comments No comments
{count} votes

Accepted answer
  1. Kedar Tamboli 171 Reputation points
    2021-09-01T12:17:43.383+00:00

    Hello All,

    I have updated the program with complete path of powershell.exe as below:
    "%Windir%\sysnative\WindowsPowerShell\v1.0\powershell.exe" -ExecutionPolicy Bypass -File Toast_PWD_Expiry.ps1

    This solved the issue.

    0 comments No comments

2 additional answers

Sort by: Most helpful
  1. Amandayou-MSFT 11,061 Reputation points
    2021-08-26T05:43:00.767+00:00

    Hi @Kedar Tamboli ,

    We could try to put these scripts in script in SCCM to check if it runs normal and put these files to shared path.

    126741-8261.png


    If the response is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

  2. Limitless Technology 39,591 Reputation points
    2021-08-26T09:14:58.45+00:00

    Hello kedar,

    Consider using the Scripts feature in the Configuration Manager console. Scripts may be a better solution for some of the preceding scenarios instead of using packages and programs.

    Try troubleshooting by considering the below steps

    1. The script needs to run in the current user’s context. Don’t run Powershell as another user and expect the toast notification to show. That goes for when running the toast with ConfigMgr as well. It needs the user’s context to display the toast notification for the logged-on user.
    2. There are combinations in the configuration which don’t make sense and I’m preventing most of them. The best advice here is to look at the included configuration examples and stick to those if things are not working.
    3. The toast notification has a limit on the sheer size of the content. That includes text elements and buttons. You can hit a combination where you have too much text in combination with the snooze option, and you will start seeing the toast rendering without buttons.
    4. ConfigMgr admins love log files! Paste the log file as a comment with a few words about your issue, and I can most likely give you the reason for your troubles.

    When you migrate packages from an earlier version of Configuration Manager, you can deploy them in your Configuration Manager hierarchy. After the migration is complete, the packages appear in the Packages node in the Software Library workspace.

    You can modify and deploy these packages in the same way you did by using software distribution. The Import-Package from Definition Wizard remains in Configuration Manager to import legacy packages. Advertisements are converted to deployments when you migrate from Configuration Manager 2007 to a Configuration Manager hierarchy.

    For Better understanding do click the below link regarding MECM (Configuration Manager)

    https://video2.skills-academy.com/en-us/mem/configmgr/apps/deploy-use/packages-and-programs

    If you use maintenance windows on the same collection to which you deploy this program, a conflict could occur if the Maximum allowed run time is longer than the scheduled maintenance window. If you set the maximum run time to Unknown, the program starts to run during the maintenance window. It then continues to run as needed after the maintenance window is closed. If you set the maximum run time to a specific period that's greater than the length of any available maintenance window, then the client doesn't run the program.

    Hope this answers all your queries, if not please do repost back.
    If an Answer is helpful, please click "Accept Answer" and upvote it : )

    Regards,
    Jainth

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.