Skip to content

imabdk/Toast-Notification-Script

Repository files navigation

Toast Notification Script

Current Version: 3.0.2

Version 3.0.0 has been rewritten for Microsoft Intune and the Remediations feature.

Toast Notification Script Examples

Quick Download

Documentation & Support

📖 Documentation: https://www.imab.dk/windows-10-toast-notification-script/

Questions & Issues: Please visit the blog post above for documentation and support.


Version 3.0.2 Overview

The Toast Notification Script has been completely rewritten in version 3.0.0 to provide native Windows toast notifications through Microsoft Intune's Remediations feature.

Key Features & What's New

  • Microsoft Intune Integration: Includes proper exit codes and Remediations workflow support
  • Flexible Scheduling: Day and hour targeting with support for multiple days and "any time" scheduling
  • Multi-Level Logging: Logging with rotation, IME integration, and fallback mechanisms
  • Personalized Notifications: Time-based greetings with user's first name and fallback options
  • Multiple Notification Types: Weekly reminders, reboot notifications, and general announcements
  • Detection Script: Included detection script for proper remediation workflow
  • Configuration Validation: Built-in conflict detection and configuration validation

Supported Scenarios

  • Weekly Reminders: Scheduled notifications for routine communication and announcements
  • Reboot Notifications: Uptime-based restart reminders for system maintenance
  • General Announcements: Flexible messaging for various organizational scenarios
  • Application Deployment: Integration with Company Portal for software deployment notifications

Requirements

  • Windows 10 version 1709 or later / Windows 11
  • PowerShell 5.1 or later
  • Microsoft Intune managed device
  • User context execution (not SYSTEM)
  • Internet connectivity for online configuration files

Constrained Language Mode Compatibility

CLM Support: The script works correctly in PowerShell Constrained Language Mode environments.

⚠️ Intune IME Issue: When deployed via Microsoft Intune IME on systems where CLM is enforced through AppLocker/WDAC policies, the script may encounter dot-sourcing errors due to IME switching language modes mid-execution (from Full Language Mode to CLM when Windows Runtime assemblies load). This creates cross-language mode boundary violations due to differences in how Intune IME handles execution context compared to other deployment methods like Configuration Manager.

Error Example: "Cannot dot-source this command because it was defined in a different language mode"

Workaround: Sign the PowerShell script with a code signing certificate from a trusted Certificate Authority and enable the "Enforce script signature check" option in Intune script deployment settings. According to Microsoft documentation, signed scripts approved by App Control/AppLocker policies run in Full Language Mode, which prevents the language mode boundary issues. The certificate must be added to the Trusted Publishers certificate store on managed devices.

Quick Start

  1. Download the files
  2. Configure the config-toast.xml file for your organization and host it online
  3. Deploy in Microsoft Intune Remediations:
    • Detection Script: Detect-ToastNotification.ps1
    • Remediation Script: Remediate-ToastNotification.ps1
    • Schedule: Configure based on your notification requirements

Intune Configuration

Intune Remediation Configuration

Configuration Highlights

The config-toast.xml file supports:

  • Feature Toggles: Enable/disable toast notifications, weekly messages, pending reboot checks
  • Scheduling Options: Flexible day/hour targeting (including "any time" options)
  • Visual Customization: Custom logos, hero images, and notification text
  • Button Configuration: Action buttons, dismiss buttons, snooze functionality
  • Language Support: Multi-language text definitions

Version History

Version 3.0.2

  • Removed PowerShell Constrained Language Mode compatibility claim (under development)

Version 3.0.1

  • Fixed empty XML space in WeeklyMessage notifications by conditionally excluding BodyText2 group

Version 3.0.0

  • Complete rewrite for Microsoft Intune with PowerShell best practices, professional documentation, and enhanced functionality

Roadmap & Future Features

Planned Features (v3.1.0+)

  • Intune IME Compatibility Fix - Architectural rewrite to eliminate function-based dot-sourcing and implement inline sequential execution to resolve Intune IME language mode switching issues
  • Disk Space Monitoring - Low disk space notifications with cleanup guidance
  • Battery Health Monitoring - Proactive notifications when laptop battery health degrades below optimal levels
  • OneDrive Sync Issues - Alert users to sync conflicts, pending files, and connectivity problems

Legacy Versions (Configuration Manager)

Version 2.3.0 - Configuration Manager Edition

For organizations still using Configuration Manager (SCCM), the legacy version remains available:

Download: ToastNotificationScript2.3.0.zip

Legacy Features (v2.3.0)

  • Custom notification app registration
  • Software Center integration
  • Integration to task sequences
  • Integration to applications and packages

⚠️ Note: The legacy ConfigMgr version (2.x) is no longer actively developed. Organizations are encouraged to migrate to Microsoft Intune and use version 3.0.0 for additional features and ongoing support.


Support & Community


License

This project is licensed under the MIT License - see the LICENSE file for details.


Author

Martin Bengtsson


About

My Windows Toast Notification Script explained in details here: https://imab.dk/windows-10-toast-notification-script/

Resources

License

Stars

Watchers

Forks