diff --git a/README.md b/README.md
index 45437dc..e86aca7 100644
--- a/README.md
+++ b/README.md
@@ -172,8 +172,8 @@ Remove scheduled tasks and scripts.
See https://github.com/Romanitho/Winget-AutoUpdate/discussions/88
## Custom script (Mods for WAU)
-**Mods for WAU** allows you to craft a script to do whatever you like via `_WAU-mods.ps1` in the **mods** folder.
-This script executes **if the network is active/any version of Winget is installed/WAU is running as SYSTEM**.
+**Mods for WAU** allows you to craft a script to do whatever you like via `_WAU-mods.ps1` in the **mods** folder.
+This script executes **if the network is active/any version of Winget is installed/WAU is running as SYSTEM**.
If **ExitCode** is **1** from `_WAU-mods.ps1` then **Re-run WAU**.
## Custom scripts (Mods feature for Apps)
From version 1.8.0, the Mods feature allows you to run additional scripts when upgrading or installing an app.
@@ -206,7 +206,7 @@ This will use the **content** of the text file as a native **winget --override**
In an enterprise environment it's crucial that different groups can have different settings in applications etc. or to implement other mandatory settings, i.e for security/management reasons.
**WAU** doesn't have any setting that can be changed except for when installing (or editing the registry/the task `Winget-AutoUpdate` as **Admin**).
With the use of **ADML/ADMX** files you can manage every **WAU** setting from within **GPO**.
-They will be detected/evaluated during the next run of **WAU** (taking effect before any actions).
+They will be detected/evaluated on a daily basis.
The **GPO ADMX/ADML** validated with: [Windows 10 - Validate ADMX for Ingestion](https://developer.vmware.com/samples/7115/windows-10---validate-admx-for-ingestion)
Read more in the `README.md` under the directory **Policies**.
diff --git a/Winget-AutoUpdate-Install.ps1 b/Winget-AutoUpdate-Install.ps1
index 3e89f95..e21a20c 100644
--- a/Winget-AutoUpdate-Install.ps1
+++ b/Winget-AutoUpdate-Install.ps1
@@ -401,10 +401,12 @@ function Install-WingetAutoUpdate {
$task = New-ScheduledTask -Action $taskAction -Principal $taskUserPrincipal -Settings $taskSettings
Register-ScheduledTask -TaskName 'Winget-AutoUpdate-Notify' -TaskPath 'WAU' -InputObject $task -Force | Out-Null
+ # Settings for the GPO scheduled task
$taskAction = New-ScheduledTaskAction -Execute "powershell.exe" -Argument "-NoProfile -ExecutionPolicy Bypass -File `"$($WingetUpdatePath)\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
+ # Set up the task, and register it
$task = New-ScheduledTask -Action $taskAction -Principal $taskUserPrincipal -Settings $taskSettings -Trigger $taskTrigger
Register-ScheduledTask -TaskName 'Winget-AutoUpdate-Policies' -TaskPath 'WAU' -InputObject $task -Force | Out-Null
diff --git a/Winget-AutoUpdate/Winget-Upgrade.ps1 b/Winget-AutoUpdate/Winget-Upgrade.ps1
index 27bbbfe..ac03bc4 100644
--- a/Winget-AutoUpdate/Winget-Upgrade.ps1
+++ b/Winget-AutoUpdate/Winget-Upgrade.ps1
@@ -303,7 +303,7 @@ if (Test-Network) {
$UserContextTask = Get-ScheduledTask -TaskName 'Winget-AutoUpdate-UserContext' -ErrorAction SilentlyContinue
if (!$UserContextTask) {
#Create the scheduled task in User context
- $taskAction = New-ScheduledTaskAction -Execute "wscript.exe" -Argument "`"$($WingetUpdatePath)\Invisible.vbs`" `"powershell.exe -NoProfile -ExecutionPolicy Bypass -File `"`"`"$($WingetUpdatePath)\winget-upgrade.ps1`"`""
+ $taskAction = New-ScheduledTaskAction -Execute "wscript.exe" -Argument "`"$($WAUConfig.InstallLocation)\Invisible.vbs`" `"powershell.exe -NoProfile -ExecutionPolicy Bypass -File `"`"`"$($WAUConfig.InstallLocation)\winget-upgrade.ps1`"`""
$taskUserPrincipal = New-ScheduledTaskPrincipal -GroupId S-1-5-11
$taskSettings = New-ScheduledTaskSettingsSet -Compatibility Win8 -AllowStartIfOnBatteries -DontStopIfGoingOnBatteries -ExecutionTimeLimit 03:00:00
$task = New-ScheduledTask -Action $taskAction -Principal $taskUserPrincipal -Settings $taskSettings
diff --git a/Winget-AutoUpdate/functions/Invoke-PostUpdateActions.ps1 b/Winget-AutoUpdate/functions/Invoke-PostUpdateActions.ps1
index 4841740..cd2e3c6 100644
--- a/Winget-AutoUpdate/functions/Invoke-PostUpdateActions.ps1
+++ b/Winget-AutoUpdate/functions/Invoke-PostUpdateActions.ps1
@@ -180,7 +180,6 @@ function Invoke-PostUpdateActions {
#Remove old functions / files
$FileNames = @(
"$WorkingDir\functions\Get-Policies.ps1",
- "$WorkingDir\functions\Get-WAUConfig.ps1",
"$WorkingDir\functions\Get-WAUCurrentVersion.ps1",
"$WorkingDir\functions\Get-WAUUpdateStatus.ps1",
"$WorkingDir\functions\Write-Log.ps1",
@@ -210,7 +209,7 @@ function Invoke-PostUpdateActions {
$UserContextTask = Get-ScheduledTask -TaskName 'Winget-AutoUpdate-UserContext' -TaskPath '\' -ErrorAction SilentlyContinue
if ($UserContextTask) {
#Remove Winget-AutoUpdate-UserContext at root.
- Unregister-ScheduledTask $UserContextTask -Confirm:$False
+ $null = $UserContextTask | Unregister-ScheduledTask -Confirm:$False
#Set it in registry as activated.
New-ItemProperty $regPath -Name WAU_UserContext -Value 1 -PropertyType DWord -Force | Out-Null