If usertask not installed, end
parent
deb734934d
commit
cc7e989e5c
|
@ -164,22 +164,17 @@ if (Test-Network) {
|
||||||
Write-Log "No new update." "Green"
|
Write-Log "No new update." "Green"
|
||||||
}
|
}
|
||||||
|
|
||||||
#Run WAU in user context if currently as system
|
#Run WAU in user context if currently as system and the user task exist
|
||||||
if ($IsSystem) {
|
$UserScheduledTask = Get-ScheduledTask -TaskName "Winget-AutoUpdate-UserContext" -ErrorAction SilentlyContinue
|
||||||
|
if ($IsSystem -and $UserScheduledTask) {
|
||||||
|
|
||||||
#Get Winget system apps to excape them befor running user context
|
#Get Winget system apps to excape them befor running user context
|
||||||
Get-WingetSystemApps
|
Get-WingetSystemApps
|
||||||
|
|
||||||
#Run user context scheduled task
|
#Run user context scheduled task
|
||||||
$UserScheduledTask = Get-ScheduledTask -TaskName "Winget-AutoUpdate-UserContext" -ErrorAction SilentlyContinue
|
Write-Log "Starting WAU in User context"
|
||||||
if ($UserScheduledTask) {
|
Start-ScheduledTask $UserScheduledTask.TaskName -ErrorAction SilentlyContinue
|
||||||
Write-Log "Starting WAU in User context"
|
Exit 0
|
||||||
Start-ScheduledTask $UserScheduledTask.TaskName -ErrorAction SilentlyContinue
|
|
||||||
Exit 0
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
Write-Log "User context execution not installed"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue