wingetautoupdate/Sources/Winget-AutoUpdate/Winget-Notify.ps1

25 lines
988 B
PowerShell
Raw Permalink Normal View History

#Send Notify Script
#get xml notif config
2024-09-13 20:22:21 +00:00
$WAUinstalledPath = Get-ItemPropertyValue -Path "HKLM:\SOFTWARE\Romanitho\Winget-AutoUpdate\" -Name InstallLocation
[xml]$NotifConf = Get-Content "$WAUinstalledPath\config\notif.xml" -Encoding UTF8 -ErrorAction SilentlyContinue
if (!($NotifConf)) {
break
2022-06-10 08:26:41 +00:00
}
#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
2022-10-26 22:49:10 +00:00
#Prepare XML
$ToastXml = [Windows.Data.Xml.Dom.XmlDocument]::New()
$ToastXml.LoadXml($NotifConf.OuterXml)
#Specify Launcher App ID
2024-09-13 20:16:46 +00:00
$LauncherID = "Windows.SystemToast.WAU.Notification"
2022-10-26 22:49:10 +00:00
#Prepare and Create Toast
$ToastMessage = [Windows.UI.Notifications.ToastNotification]::New($ToastXML)
$ToastMessage.Tag = $NotifConf.toast.tag
[Windows.UI.Notifications.ToastNotificationManager]::CreateToastNotifier($LauncherID).Show($ToastMessage)