Move function declaration to top
	
		
			
	
		
	
	
		
	
		
			Some checks reported errors
		
		
	
	
		
			
				
	
				continuous-integration/drone/push Build was killed
				
			
		
		
	
	
				
					
				
			
		
			Some checks reported errors
		
		
	
	continuous-integration/drone/push Build was killed
				
			This commit is contained in:
		| @@ -4,6 +4,29 @@ Param( | |||||||
|     # No parameters |     # 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 = @{ | $NewEventLogSplat = @{ | ||||||
|     LogName     = 'Application' |     LogName     = 'Application' | ||||||
|     Source      = 'OVF-Properties' |     Source      = 'OVF-Properties' | ||||||
| @@ -331,26 +354,3 @@ $WriteEventLogSplat = @{ | |||||||
| } | } | ||||||
| Write-EventLog @WriteEventLogSplat | Write-EventLog @WriteEventLogSplat | ||||||
| & schtasks.exe /Change /TN 'OVF-Properties' /DISABLE | & 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)) |  | ||||||
| } |  | ||||||
		Reference in New Issue
	
	Block a user