Move function declaration to top
continuous-integration/drone/push Build was killed Details

This commit is contained in:
Danny Bessems 2021-01-27 15:47:29 +01:00
parent e74d0a23e3
commit e14f9469cb
1 changed files with 23 additions and 23 deletions

View File

@ -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))
}