diff --git a/scripts/ADDS/payload/Apply-OVFProperties.ps1 b/scripts/ADDS/payload/Apply-OVFProperties.ps1 index 73b83f9..dd57a3e 100644 --- a/scripts/ADDS/payload/Apply-OVFProperties.ps1 +++ b/scripts/ADDS/payload/Apply-OVFProperties.ps1 @@ -4,6 +4,29 @@ Param( # No parameters ) +Function New-ToastNotification { + Param( + [Parameter] + [string]$Stream = 'OVF Properties', + [Parameter(Mandatory)] + [string]$Title, + [Parameter(Mandatory)] + [string]$Text + ) + + $Template = [Windows.UI.Notifications.ToastNotificationManager]::GetTemplateContent([Windows.UI.Notifications.ToastTemplateType]::ToastText02) + + $XML = [xml]$Template.GetXml() + $XML.SelectSingleNode("toast/visual/binding/text[@id='1']").InnerText = $Title + $XML.SelectSingleNode("toast/visual/binding/text[@id='2']").InnerText = $Text + + $SerializedXml = New-Object Windows.Data.Xml.Dom.XmlDocument + $SerializedXml.LoadXml($XML.OuterXml) + + $Notifier = [Windows.UI.Notifications.ToastNotificationManager]::CreateToastNotifier($Stream) + $Notifier.Show([Windows.UI.Notifications.ToastNotification]::new($SerializedXml)) +} + $NewEventLogSplat = @{ LogName = 'Application' Source = 'OVF-Properties' @@ -331,26 +354,3 @@ $WriteEventLogSplat = @{ } Write-EventLog @WriteEventLogSplat & schtasks.exe /Change /TN 'OVF-Properties' /DISABLE - -Function New-ToastNotification { - Param( - [Parameter] - [string]$Stream = 'OVF Properties', - [Parameter(Mandatory)] - [string]$Title, - [Parameter(Mandatory)] - [string]$Text - ) - - $Template = [Windows.UI.Notifications.ToastNotificationManager]::GetTemplateContent([Windows.UI.Notifications.ToastTemplateType]::ToastText02) - - $XML = [xml]$Template.GetXml() - $XML.SelectSingleNode("toast/visual/binding/text[@id='1']").InnerText = $Title - $XML.SelectSingleNode("toast/visual/binding/text[@id='2']").InnerText = $Text - - $SerializedXml = New-Object Windows.Data.Xml.Dom.XmlDocument - $SerializedXml.LoadXml($XML.OuterXml) - - $Notifier = [Windows.UI.Notifications.ToastNotificationManager]::CreateToastNotifier($Stream) - $Notifier.Show([Windows.UI.Notifications.ToastNotification]::new($SerializedXml)) -} \ No newline at end of file