Merge pull request #432 from Romanitho/fix-GPO-task

Fix GPO Task creation on post update actions
pull/434/head
Romain 2023-10-19 14:03:03 +02:00 committed by GitHub
commit 74181fbfd4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -187,7 +187,7 @@ function Invoke-PostUpdateActions {
#Set GPO scheduled task if not existing
$GPOTask = Get-ScheduledTask -TaskName 'Winget-AutoUpdate-Policies' -ErrorAction SilentlyContinue
if (!$GPOTask) {
$taskAction = New-ScheduledTaskAction -Execute "powershell.exe" -Argument "-NoProfile -ExecutionPolicy Bypass -File `"$($WingetUpdatePath)\WAU-Policies.ps1`""
$taskAction = New-ScheduledTaskAction -Execute "powershell.exe" -Argument "-NoProfile -ExecutionPolicy Bypass -File `"$($WorkingDir)\WAU-Policies.ps1`""
$tasktrigger = New-ScheduledTaskTrigger -Daily -At 6am
$taskUserPrincipal = New-ScheduledTaskPrincipal -UserId S-1-5-18 -RunLevel Highest
$taskSettings = New-ScheduledTaskSettingsSet -Compatibility Win8 -StartWhenAvailable -AllowStartIfOnBatteries -DontStopIfGoingOnBatteries -ExecutionTimeLimit 00:05:00