Update Toast_Notify.ps1

This commit is contained in:
Ben Whitmore 2021-01-09 14:56:26 +00:00
parent 8abfe35abd
commit cb82053923

View file

@ -134,8 +134,8 @@ If (([System.Security.Principal.WindowsIdentity]::GetCurrent()).Name -eq "NT AUT
$Task_Trigger.EndBoundary = $Task_Expiry $Task_Trigger.EndBoundary = $Task_Expiry
$Task_Principal = New-ScheduledTaskPrincipal -UserId $LoggedOnUserName -LogonType ServiceAccount $Task_Principal = New-ScheduledTaskPrincipal -UserId $LoggedOnUserName -LogonType ServiceAccount
$Task_Settings = New-ScheduledTaskSettingsSet -Compatibility V1 -DeleteExpiredTaskAfter (New-TimeSpan -Seconds 600) $Task_Settings = New-ScheduledTaskSettingsSet -Compatibility V1 -DeleteExpiredTaskAfter (New-TimeSpan -Seconds 600)
$New_Task = New-ScheduledTask -Description "Toast_Notififcation_$($LoggedOnUserSID)_$($ToastGuid) Task for user notification" -Action $Task_Action -Principal $Task_Principal -Trigger $Task_Trigger -Settings $Task_Settings $New_Task = New-ScheduledTask -Description "Toast_Notification_$($LoggedOnUserSID)_$($ToastGuid) Task for user notification" -Action $Task_Action -Principal $Task_Principal -Trigger $Task_Trigger -Settings $Task_Settings
Register-ScheduledTask -TaskName "Toast_Notififcation_$($LoggedOnUserSID)_$($ToastGuid)" -InputObject $New_Task Register-ScheduledTask -TaskName "Toast_Notification_$($LoggedOnUserSID)_$($ToastGuid)" -InputObject $New_Task
} }
#Run the toast of the script is running in the context of the Logged On User #Run the toast of the script is running in the context of the Logged On User