2023-09-15 14:33:51 +00:00
|
|
|
# Send Notify Script
|
2022-02-14 16:28:22 +00:00
|
|
|
|
2023-09-15 14:33:51 +00:00
|
|
|
# get xml notif config
|
|
|
|
$WAUinstalledPath = (Get-ItemPropertyValue -Path 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Winget-AutoUpdate\' -Name InstallLocation)
|
|
|
|
[xml]$NotifConf = (Get-Content -Path "$WAUinstalledPath\config\notif.xml" -Encoding UTF8 -ErrorAction SilentlyContinue)
|
|
|
|
|
2023-09-15 14:38:54 +00:00
|
|
|
if (!($NotifConf))
|
2023-09-15 14:33:51 +00:00
|
|
|
{
|
|
|
|
break
|
2022-06-10 08:26:41 +00:00
|
|
|
}
|
2022-02-14 16:28:22 +00:00
|
|
|
|
2023-09-15 14:33:51 +00:00
|
|
|
# Load Assemblies
|
|
|
|
$null = (Add-Type -AssemblyName Windows.Data)
|
|
|
|
$null = (Add-Type -AssemblyName Windows.UI)
|
|
|
|
|
|
|
|
$null = [Windows.UI.Notifications.ToastNotificationManager, Windows.UI.Notifications, ContentType = WindowsRuntime]
|
|
|
|
$null = [Windows.Data.Xml.Dom.XmlDocument, Windows.Data.Xml.Dom.XmlDocument, ContentType = WindowsRuntime]
|
2022-10-26 22:49:10 +00:00
|
|
|
|
2023-09-15 14:33:51 +00:00
|
|
|
# Prepare XML
|
2022-02-14 16:28:22 +00:00
|
|
|
$ToastXml = [Windows.Data.Xml.Dom.XmlDocument]::New()
|
|
|
|
$ToastXml.LoadXml($NotifConf.OuterXml)
|
|
|
|
|
2023-09-15 14:33:51 +00:00
|
|
|
# Specify Launcher App ID
|
|
|
|
$LauncherID = 'Windows.SystemToast.Winget.Notification'
|
2022-10-26 22:49:10 +00:00
|
|
|
|
2023-09-15 14:33:51 +00:00
|
|
|
# Prepare and Create Toast
|
|
|
|
$ToastMessage = [Windows.UI.Notifications.ToastNotification]::New($ToastXml)
|
2022-02-14 16:28:22 +00:00
|
|
|
$ToastMessage.Tag = $NotifConf.toast.tag
|
2022-10-23 07:19:23 +00:00
|
|
|
[Windows.UI.Notifications.ToastNotificationManager]::CreateToastNotifier($LauncherID).Show($ToastMessage)
|