If !$TestWinget no need to continue?
parent
e5bc0b663c
commit
21b5fa8269
|
@ -165,23 +165,23 @@ if (Test-Network) {
|
||||||
if ($InstallOK -eq 0) {
|
if ($InstallOK -eq 0) {
|
||||||
Write-Log "No new update." "Green"
|
Write-Log "No new update." "Green"
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
#Run WAU in user context if currently as system
|
|
||||||
if ($IsSystem) {
|
|
||||||
|
|
||||||
#Get Winget system apps to excape them befor running user context
|
#Run WAU in user context if currently as system
|
||||||
Get-WingetSystemApps
|
if ($IsSystem) {
|
||||||
|
|
||||||
#Run user context scheduled task
|
#Get Winget system apps to excape them befor running user context
|
||||||
$UserScheduledTask = Get-ScheduledTask -TaskName "Winget-AutoUpdate-UserContext" -ErrorAction SilentlyContinue
|
Get-WingetSystemApps
|
||||||
if ($UserScheduledTask) {
|
|
||||||
Write-Log "Starting WAU in User context"
|
#Run user context scheduled task
|
||||||
Start-ScheduledTask $UserScheduledTask.TaskName -ErrorAction SilentlyContinue
|
$UserScheduledTask = Get-ScheduledTask -TaskName "Winget-AutoUpdate-UserContext" -ErrorAction SilentlyContinue
|
||||||
Exit 0
|
if ($UserScheduledTask) {
|
||||||
}
|
Write-Log "Starting WAU in User context"
|
||||||
else {
|
Start-ScheduledTask $UserScheduledTask.TaskName -ErrorAction SilentlyContinue
|
||||||
Write-Log "User context execution not installed"
|
Exit 0
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Write-Log "User context execution not installed"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue