vscode auto-format
parent
c095e377d7
commit
a4112a5154
|
@ -1,4 +1,4 @@
|
||||||
<#
|
<#
|
||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
Configure Winget to daily update installed apps.
|
Configure Winget to daily update installed apps.
|
||||||
|
|
||||||
|
@ -211,7 +211,7 @@ function Install-WingetAutoUpdate {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
#Keep critical files
|
#Keep critical files
|
||||||
Get-ChildItem -Path $WingetUpdatePath -Exclude *.txt,mods,logs | Remove-Item -Recurse -Force
|
Get-ChildItem -Path $WingetUpdatePath -Exclude *.txt, mods, logs | Remove-Item -Recurse -Force
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Copy-Item -Path "$PSScriptRoot\Winget-AutoUpdate\*" -Destination $WingetUpdatePath -Recurse -Force -ErrorAction SilentlyContinue
|
Copy-Item -Path "$PSScriptRoot\Winget-AutoUpdate\*" -Destination $WingetUpdatePath -Recurse -Force -ErrorAction SilentlyContinue
|
||||||
|
@ -223,7 +223,7 @@ function Install-WingetAutoUpdate {
|
||||||
Copy-Item -Path "$PSScriptRoot\included_apps.txt" -Destination $WingetUpdatePath -Recurse -Force -ErrorAction SilentlyContinue
|
Copy-Item -Path "$PSScriptRoot\included_apps.txt" -Destination $WingetUpdatePath -Recurse -Force -ErrorAction SilentlyContinue
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (!$ListPath){
|
if (!$ListPath) {
|
||||||
New-Item -Path $WingetUpdatePath -Name "included_apps.txt" -ItemType "file" -ErrorAction SilentlyContinue | Out-Null
|
New-Item -Path $WingetUpdatePath -Name "included_apps.txt" -ItemType "file" -ErrorAction SilentlyContinue | Out-Null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -233,7 +233,7 @@ function Install-WingetAutoUpdate {
|
||||||
Copy-Item -Path "$PSScriptRoot\included_apps.txt" -Destination $WingetUpdatePath -Recurse -Force -ErrorAction SilentlyContinue
|
Copy-Item -Path "$PSScriptRoot\included_apps.txt" -Destination $WingetUpdatePath -Recurse -Force -ErrorAction SilentlyContinue
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (!$ListPath){
|
if (!$ListPath) {
|
||||||
New-Item -Path $WingetUpdatePath -Name "included_apps.txt" -ItemType "file" -ErrorAction SilentlyContinue | Out-Null
|
New-Item -Path $WingetUpdatePath -Name "included_apps.txt" -ItemType "file" -ErrorAction SilentlyContinue | Out-Null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -330,16 +330,16 @@ function Install-WingetAutoUpdate {
|
||||||
if (!$RunOnMetered) {
|
if (!$RunOnMetered) {
|
||||||
New-ItemProperty $regPath -Name WAU_DoNotRunOnMetered -Value 1 -PropertyType DWord -Force | Out-Null
|
New-ItemProperty $regPath -Name WAU_DoNotRunOnMetered -Value 1 -PropertyType DWord -Force | Out-Null
|
||||||
}
|
}
|
||||||
if ($ListPath){
|
if ($ListPath) {
|
||||||
New-ItemProperty $regPath -Name WAU_ListPath -Value $ListPath -Force | Out-Null
|
New-ItemProperty $regPath -Name WAU_ListPath -Value $ListPath -Force | Out-Null
|
||||||
}
|
}
|
||||||
if ($BypassListForUsers){
|
if ($BypassListForUsers) {
|
||||||
New-ItemProperty $regPath -Name WAU_BypassListForUsers -Value 1 -PropertyType DWord -Force | Out-Null
|
New-ItemProperty $regPath -Name WAU_BypassListForUsers -Value 1 -PropertyType DWord -Force | Out-Null
|
||||||
}
|
}
|
||||||
|
|
||||||
#Set ACL for users on logfile
|
#Set ACL for users on logfile
|
||||||
$LogFile = "$WingetUpdatePath\logs\updates.log"
|
$LogFile = "$WingetUpdatePath\logs\updates.log"
|
||||||
if (test-path $LogFile){
|
if (test-path $LogFile) {
|
||||||
$NewAcl = Get-Acl -Path $LogFile
|
$NewAcl = Get-Acl -Path $LogFile
|
||||||
$identity = New-Object System.Security.Principal.SecurityIdentifier S-1-5-11
|
$identity = New-Object System.Security.Principal.SecurityIdentifier S-1-5-11
|
||||||
$fileSystemRights = "Modify"
|
$fileSystemRights = "Modify"
|
||||||
|
@ -393,7 +393,7 @@ function Uninstall-WingetAutoUpdate {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
#Keep critical files
|
#Keep critical files
|
||||||
Get-ChildItem -Path $InstallLocation -Exclude *.txt,mods,logs | Remove-Item -Recurse -Force
|
Get-ChildItem -Path $InstallLocation -Exclude *.txt, mods, logs | Remove-Item -Recurse -Force
|
||||||
}
|
}
|
||||||
Get-ScheduledTask -TaskName "Winget-AutoUpdate" -ErrorAction SilentlyContinue | Unregister-ScheduledTask -Confirm:$False
|
Get-ScheduledTask -TaskName "Winget-AutoUpdate" -ErrorAction SilentlyContinue | Unregister-ScheduledTask -Confirm:$False
|
||||||
Get-ScheduledTask -TaskName "Winget-AutoUpdate-Notify" -ErrorAction SilentlyContinue | Unregister-ScheduledTask -Confirm:$False
|
Get-ScheduledTask -TaskName "Winget-AutoUpdate-Notify" -ErrorAction SilentlyContinue | Unregister-ScheduledTask -Confirm:$False
|
||||||
|
|
|
@ -45,7 +45,7 @@ try {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
#Keep critical files
|
#Keep critical files
|
||||||
Get-ChildItem -Path $InstallLocation -Exclude *.txt,mods,logs | Remove-Item -Recurse -Force
|
Get-ChildItem -Path $InstallLocation -Exclude *.txt, mods, logs | Remove-Item -Recurse -Force
|
||||||
}
|
}
|
||||||
Get-ScheduledTask -TaskName "Winget-AutoUpdate" -ErrorAction SilentlyContinue | Unregister-ScheduledTask -Confirm:$False
|
Get-ScheduledTask -TaskName "Winget-AutoUpdate" -ErrorAction SilentlyContinue | Unregister-ScheduledTask -Confirm:$False
|
||||||
Get-ScheduledTask -TaskName "Winget-AutoUpdate-Notify" -ErrorAction SilentlyContinue | Unregister-ScheduledTask -Confirm:$False
|
Get-ScheduledTask -TaskName "Winget-AutoUpdate-Notify" -ErrorAction SilentlyContinue | Unregister-ScheduledTask -Confirm:$False
|
||||||
|
|
|
@ -5,7 +5,7 @@ Function Get-AppInfo ($AppID) {
|
||||||
$String = & $winget show $AppID --accept-source-agreements -s winget | Out-String
|
$String = & $winget show $AppID --accept-source-agreements -s winget | Out-String
|
||||||
|
|
||||||
#Search for Release Note info
|
#Search for Release Note info
|
||||||
$ReleaseNote = [regex]::match($String,"(?<=Release Notes Url: )(.*)(?=\n)").Groups[0].Value
|
$ReleaseNote = [regex]::match($String, "(?<=Release Notes Url: )(.*)(?=\n)").Groups[0].Value
|
||||||
|
|
||||||
#Return Release Note
|
#Return Release Note
|
||||||
return $ReleaseNote
|
return $ReleaseNote
|
||||||
|
|
|
@ -4,7 +4,7 @@ function Get-ExcludedApps {
|
||||||
|
|
||||||
if (Test-Path "$WorkingDir\excluded_apps.txt") {
|
if (Test-Path "$WorkingDir\excluded_apps.txt") {
|
||||||
|
|
||||||
return (Get-Content -Path "$WorkingDir\excluded_apps.txt").Trim() | Where-Object{$_.length -gt 0}
|
return (Get-Content -Path "$WorkingDir\excluded_apps.txt").Trim() | Where-Object { $_.length -gt 0 }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ function Get-IncludedApps {
|
||||||
|
|
||||||
if (Test-Path "$WorkingDir\included_apps.txt") {
|
if (Test-Path "$WorkingDir\included_apps.txt") {
|
||||||
|
|
||||||
return (Get-Content -Path "$WorkingDir\included_apps.txt").Trim() | Where-Object{$_.length -gt 0}
|
return (Get-Content -Path "$WorkingDir\included_apps.txt").Trim() | Where-Object { $_.length -gt 0 }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@ function Get-WingetOutdatedApps {
|
||||||
|
|
||||||
# Now cycle in real package and split accordingly
|
# Now cycle in real package and split accordingly
|
||||||
$upgradeList = @()
|
$upgradeList = @()
|
||||||
For ($i = $fl + 2; $i -lt $lines.Length -1; $i++) {
|
For ($i = $fl + 2; $i -lt $lines.Length - 1; $i++) {
|
||||||
$line = $lines[$i]
|
$line = $lines[$i]
|
||||||
if ($line) {
|
if ($line) {
|
||||||
$software = [Software]::new()
|
$software = [Software]::new()
|
||||||
|
@ -55,8 +55,8 @@ function Get-WingetOutdatedApps {
|
||||||
#If current user is not system, remove system apps from list
|
#If current user is not system, remove system apps from list
|
||||||
if ($IsSystem -eq $false) {
|
if ($IsSystem -eq $false) {
|
||||||
$SystemApps = Get-Content -Path "$WorkingDir\winget_system_apps.txt"
|
$SystemApps = Get-Content -Path "$WorkingDir\winget_system_apps.txt"
|
||||||
$upgradeList = $upgradeList | Where-Object {$SystemApps -notcontains $_.Id}
|
$upgradeList = $upgradeList | Where-Object { $SystemApps -notcontains $_.Id }
|
||||||
}
|
}
|
||||||
|
|
||||||
return $upgradeList | Sort-Object {Get-Random}
|
return $upgradeList | Sort-Object { Get-Random }
|
||||||
}
|
}
|
|
@ -89,7 +89,7 @@ function Invoke-PostUpdateActions {
|
||||||
|
|
||||||
#Set new User Context task and Set system task readable/runnable for all users
|
#Set new User Context task and Set system task readable/runnable for all users
|
||||||
$UserTask = Get-ScheduledTask -TaskName "Winget-AutoUpdate-UserContext" -ErrorAction SilentlyContinue
|
$UserTask = Get-ScheduledTask -TaskName "Winget-AutoUpdate-UserContext" -ErrorAction SilentlyContinue
|
||||||
if (!$UserTask){
|
if (!$UserTask) {
|
||||||
# Settings for the scheduled task in User context
|
# Settings for the scheduled task in User context
|
||||||
$taskAction = New-ScheduledTaskAction -Execute "wscript.exe" -Argument "`"$($WorkingDir)\Invisible.vbs`" `"powershell.exe -NoProfile -ExecutionPolicy Bypass -File `"`"`"$($WorkingDir)\winget-upgrade.ps1`"`""
|
$taskAction = New-ScheduledTaskAction -Execute "wscript.exe" -Argument "`"$($WorkingDir)\Invisible.vbs`" `"powershell.exe -NoProfile -ExecutionPolicy Bypass -File `"`"`"$($WorkingDir)\winget-upgrade.ps1`"`""
|
||||||
$taskUserPrincipal = New-ScheduledTaskPrincipal -GroupId S-1-5-11
|
$taskUserPrincipal = New-ScheduledTaskPrincipal -GroupId S-1-5-11
|
||||||
|
|
|
@ -5,7 +5,7 @@ function Start-NotifTask ($Title, $Message, $MessageType, $Balise, $OnClickActio
|
||||||
if (($WAUConfig.WAU_NotificationLevel -eq "Full") -or ($WAUConfig.WAU_NotificationLevel -eq "SuccessOnly" -and $MessageType -eq "Success") -or ($UserRun)) {
|
if (($WAUConfig.WAU_NotificationLevel -eq "Full") -or ($WAUConfig.WAU_NotificationLevel -eq "SuccessOnly" -and $MessageType -eq "Success") -or ($UserRun)) {
|
||||||
|
|
||||||
#Prepare OnClickAction (if set)
|
#Prepare OnClickAction (if set)
|
||||||
if ($OnClickAction){
|
if ($OnClickAction) {
|
||||||
$ToastOnClickAction = "activationType='protocol' launch='$OnClickAction'"
|
$ToastOnClickAction = "activationType='protocol' launch='$OnClickAction'"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,16 +2,16 @@
|
||||||
|
|
||||||
function Test-ListPath ($ListPath, $UseWhiteList, $WingetUpdatePath) {
|
function Test-ListPath ($ListPath, $UseWhiteList, $WingetUpdatePath) {
|
||||||
# URL, UNC or Local Path
|
# URL, UNC or Local Path
|
||||||
if ($UseWhiteList){
|
if ($UseWhiteList) {
|
||||||
$ListType="included_apps.txt"
|
$ListType = "included_apps.txt"
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$ListType="excluded_apps.txt"
|
$ListType = "excluded_apps.txt"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Get local and external list paths
|
# Get local and external list paths
|
||||||
$LocalList = -join($WingetUpdatePath, "\", $ListType)
|
$LocalList = -join ($WingetUpdatePath, "\", $ListType)
|
||||||
$ExternalList = -join($ListPath, "\", $ListType)
|
$ExternalList = -join ($ListPath, "\", $ListType)
|
||||||
|
|
||||||
# Check if a list exists
|
# Check if a list exists
|
||||||
if (Test-Path "$LocalList") {
|
if (Test-Path "$LocalList") {
|
||||||
|
@ -19,8 +19,8 @@ function Test-ListPath ($ListPath, $UseWhiteList, $WingetUpdatePath) {
|
||||||
}
|
}
|
||||||
|
|
||||||
# If path is URL
|
# If path is URL
|
||||||
if ($ListPath -like "http*"){
|
if ($ListPath -like "http*") {
|
||||||
$ExternalList = -join($ListPath, "/", $ListType)
|
$ExternalList = -join ($ListPath, "/", $ListType)
|
||||||
$wc = New-Object System.Net.WebClient
|
$wc = New-Object System.Net.WebClient
|
||||||
try {
|
try {
|
||||||
$wc.OpenRead("$ExternalList").Close() | Out-Null
|
$wc.OpenRead("$ExternalList").Close() | Out-Null
|
||||||
|
@ -41,7 +41,7 @@ function Test-ListPath ($ListPath, $UseWhiteList, $WingetUpdatePath) {
|
||||||
}
|
}
|
||||||
# If path is UNC or local
|
# If path is UNC or local
|
||||||
else {
|
else {
|
||||||
if(Test-Path -Path $ExternalList -PathType leaf){
|
if (Test-Path -Path $ExternalList -PathType leaf) {
|
||||||
$dateExternal = (Get-Item "$ExternalList").LastWriteTime.ToString("yyyy-MM-dd HH:mm:ss")
|
$dateExternal = (Get-Item "$ExternalList").LastWriteTime.ToString("yyyy-MM-dd HH:mm:ss")
|
||||||
if ($dateExternal -gt $dateLocal) {
|
if ($dateExternal -gt $dateLocal) {
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -19,7 +19,7 @@ function Test-Network {
|
||||||
[void][Windows.Networking.Connectivity.NetworkInformation, Windows, ContentType = WindowsRuntime]
|
[void][Windows.Networking.Connectivity.NetworkInformation, Windows, ContentType = WindowsRuntime]
|
||||||
$cost = [Windows.Networking.Connectivity.NetworkInformation]::GetInternetConnectionProfile().GetConnectionCost()
|
$cost = [Windows.Networking.Connectivity.NetworkInformation]::GetInternetConnectionProfile().GetConnectionCost()
|
||||||
|
|
||||||
if ($cost.ApproachingDataLimit -or $cost.OverDataLimit -or $cost.Roaming -or $cost.BackgroundDataUsageRestricted -or ($cost.NetworkCostType -ne "Unrestricted")){
|
if ($cost.ApproachingDataLimit -or $cost.OverDataLimit -or $cost.Roaming -or $cost.BackgroundDataUsageRestricted -or ($cost.NetworkCostType -ne "Unrestricted")) {
|
||||||
|
|
||||||
Write-Log "Metered connection detected." "Yellow"
|
Write-Log "Metered connection detected." "Yellow"
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ function Test-Network {
|
||||||
return $false
|
return $false
|
||||||
|
|
||||||
}
|
}
|
||||||
else{
|
else {
|
||||||
|
|
||||||
Write-Log "WAU is configured to force update checking on metered connection"
|
Write-Log "WAU is configured to force update checking on metered connection"
|
||||||
return $true
|
return $true
|
||||||
|
@ -37,7 +37,7 @@ function Test-Network {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else{
|
else {
|
||||||
|
|
||||||
return $true
|
return $true
|
||||||
|
|
||||||
|
|
|
@ -9,13 +9,13 @@ function Test-PendingReboot {
|
||||||
$WMI_Reg = [WMIClass] "\\$Computer\root\default:StdRegProv"
|
$WMI_Reg = [WMIClass] "\\$Computer\root\default:StdRegProv"
|
||||||
|
|
||||||
if ($WMI_Reg) {
|
if ($WMI_Reg) {
|
||||||
if (($WMI_Reg.EnumKey($HKLM,"SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\")).sNames -contains 'RebootPending') {$PendingReboot = $true}
|
if (($WMI_Reg.EnumKey($HKLM, "SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\")).sNames -contains 'RebootPending') { $PendingReboot = $true }
|
||||||
if (($WMI_Reg.EnumKey($HKLM,"SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\")).sNames -contains 'RebootRequired') {$PendingReboot = $true}
|
if (($WMI_Reg.EnumKey($HKLM, "SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\")).sNames -contains 'RebootRequired') { $PendingReboot = $true }
|
||||||
|
|
||||||
#Checking for SCCM namespace
|
#Checking for SCCM namespace
|
||||||
$SCCM_Namespace = Get-WmiObject -Namespace ROOT\CCM\ClientSDK -List -ComputerName $Computer -ErrorAction Ignore
|
$SCCM_Namespace = Get-WmiObject -Namespace ROOT\CCM\ClientSDK -List -ComputerName $Computer -ErrorAction Ignore
|
||||||
if ($SCCM_Namespace) {
|
if ($SCCM_Namespace) {
|
||||||
if (([WmiClass]"\\$Computer\ROOT\CCM\ClientSDK:CCM_ClientUtilities").DetermineIfRebootPending().RebootPending -eq $true) {$PendingReboot = $true}
|
if (([WmiClass]"\\$Computer\ROOT\CCM\ClientSDK:CCM_ClientUtilities").DetermineIfRebootPending().RebootPending -eq $true) { $PendingReboot = $true }
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,12 +19,12 @@ https://github.com/Romanitho/Winget-AutoUpdate
|
||||||
|
|
||||||
[CmdletBinding()]
|
[CmdletBinding()]
|
||||||
param(
|
param(
|
||||||
[Parameter(Mandatory=$False)] [Switch] $Logs = $false,
|
[Parameter(Mandatory = $False)] [Switch] $Logs = $false,
|
||||||
[Parameter(Mandatory=$False)] [Switch] $Help = $false
|
[Parameter(Mandatory = $False)] [Switch] $Help = $false
|
||||||
)
|
)
|
||||||
|
|
||||||
function Test-WAUisRunning {
|
function Test-WAUisRunning {
|
||||||
If (((Get-ScheduledTask -TaskName 'Winget-AutoUpdate').State -ne 'Ready') -or ((Get-ScheduledTask -TaskName 'Winget-AutoUpdate-UserContext').State -ne 'Ready')) {
|
If (((Get-ScheduledTask -TaskName 'Winget-AutoUpdate').State -ne 'Ready') -or ((Get-ScheduledTask -TaskName 'Winget-AutoUpdate-UserContext').State -ne 'Ready')) {
|
||||||
Return $True
|
Return $True
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#Send Notif Script
|
#Send Notif Script
|
||||||
|
|
||||||
#get xml notif config
|
#get xml notif config
|
||||||
[xml]$NotifConf = Get-Content "$env:ProgramData\Winget-AutoUpdate\config\notif.xml" -Encoding UTF8 -ErrorAction SilentlyContinue
|
[xml]$NotifConf = Get-Content "$env:ProgramData\Winget-AutoUpdate\config\notif.xml" -Encoding UTF8 -ErrorAction SilentlyContinue
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
<# LOAD FUNCTIONS #>
|
<# LOAD FUNCTIONS #>
|
||||||
|
|
||||||
#Get Working Dir
|
#Get Working Dir
|
||||||
$Script:WorkingDir = $PSScriptRoot
|
$Script:WorkingDir = $PSScriptRoot
|
||||||
|
@ -18,7 +18,7 @@ Start-Init
|
||||||
if ($IsSystem) {
|
if ($IsSystem) {
|
||||||
Write-Log "Running in System context"
|
Write-Log "Running in System context"
|
||||||
}
|
}
|
||||||
else{
|
else {
|
||||||
Write-Log "Running in User context"
|
Write-Log "Running in User context"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,7 +66,7 @@ if (Test-Network) {
|
||||||
if ($IsSystem) {
|
if ($IsSystem) {
|
||||||
Update-WAU
|
Update-WAU
|
||||||
}
|
}
|
||||||
else{
|
else {
|
||||||
Write-Log "WAU Needs to run as system to update" "Yellow"
|
Write-Log "WAU Needs to run as system to update" "Yellow"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -76,7 +76,7 @@ if (Test-Network) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($IsSystem) {
|
if ($IsSystem) {
|
||||||
#Get External ListPath
|
#Get External ListPath
|
||||||
if ($WAUConfig.WAU_ListPath) {
|
if ($WAUConfig.WAU_ListPath) {
|
||||||
Write-Log "WAU uses External Lists from: $($WAUConfig.WAU_ListPath)"
|
Write-Log "WAU uses External Lists from: $($WAUConfig.WAU_ListPath)"
|
||||||
$NewList = Test-ListPath $WAUConfig.WAU_ListPath $WAUConfig.WAU_UseWhiteList $WAUConfig.InstallLocation
|
$NewList = Test-ListPath $WAUConfig.WAU_ListPath $WAUConfig.WAU_UseWhiteList $WAUConfig.InstallLocation
|
||||||
|
@ -121,7 +121,7 @@ if (Test-Network) {
|
||||||
$Script:InstallOK = 0
|
$Script:InstallOK = 0
|
||||||
|
|
||||||
#Trick under user context when -BypassListForUsers is used
|
#Trick under user context when -BypassListForUsers is used
|
||||||
if ($IsSystem -eq $false -and $WAUConfig.WAU_BypassListForUsers -eq $true){
|
if ($IsSystem -eq $false -and $WAUConfig.WAU_BypassListForUsers -eq $true) {
|
||||||
Write-Log "Bypass system list in user context is Enabled."
|
Write-Log "Bypass system list in user context is Enabled."
|
||||||
$UseWhiteList = $false
|
$UseWhiteList = $false
|
||||||
$toSkip = $null
|
$toSkip = $null
|
||||||
|
@ -179,7 +179,7 @@ if ($IsSystem) {
|
||||||
|
|
||||||
#Run user context scheduled task
|
#Run user context scheduled task
|
||||||
$UserScheduledTask = Get-ScheduledTask -TaskName "Winget-AutoUpdate-UserContext" -ErrorAction SilentlyContinue
|
$UserScheduledTask = Get-ScheduledTask -TaskName "Winget-AutoUpdate-UserContext" -ErrorAction SilentlyContinue
|
||||||
if ($UserScheduledTask){
|
if ($UserScheduledTask) {
|
||||||
Write-Log "Starting WAU in User context"
|
Write-Log "Starting WAU in User context"
|
||||||
Start-ScheduledTask $UserScheduledTask.TaskName -ErrorAction SilentlyContinue
|
Start-ScheduledTask $UserScheduledTask.TaskName -ErrorAction SilentlyContinue
|
||||||
Exit 0
|
Exit 0
|
||||||
|
|
Loading…
Reference in New Issue