Skip to content

Commit 43ef8f2

Browse files
authored
Merge pull request #1010 from Romanitho/release/2.7.0
Release 2.7.0
2 parents b162041 + 5648792 commit 43ef8f2

File tree

8 files changed

+44
-42
lines changed

8 files changed

+44
-42
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ The following command will install WAU through winget itself in the newest versi
2626
```batch
2727
winget install Romanitho.Winget-AutoUpdate
2828
```
29+
#### Alternative installation (for home admin users)
30+
You can also download the latest release of the add-on [WAU Settings GUI (for Winget-AutoUpdate)](https://github.com/KnifMelti/WAU-Settings-GUI) and install it (this will install both **WAU** and a **GUI** that provides a user-friendly portable standalone interface to modify every aspect of **Winget-AutoUpdate (WAU)** settings).
2931

3032
## Configurations
3133
### Keep some apps out of Winget-AutoUpdate

Sources/Policies/ADMX/WAU.admx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<policyDefinitions xmlns:xsd="http://www.w3.org/2001/XMLSchema"
3-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" revision="5.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" revision="5.1"
44
schemaVersion="1.0" xmlns="http://www.microsoft.com/GroupPolicy/PolicyDefinitions">
55
<policyNamespaces>
66
<target prefix="WAU" namespace="Romanitho.Policies.WAU" />
77
</policyNamespaces>
8-
<resources minRequiredRevision="4.8" fallbackCulture="en-us" />
8+
<resources minRequiredRevision="5.1" fallbackCulture="en-us" />
99
<supportedOn>
1010
<definitions>
1111
<definition name="SUPPORTED_WAU_1_16_0" displayName="$(string.SUPPORTED_WAU_1_16_0)" />

Sources/Policies/ADMX/en-US/WAU.adml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<policyDefinitionResources xmlns:xsd="http://www.w3.org/2001/XMLSchema"
3-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" revision="4.9" schemaVersion="1.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" revision="5.1" schemaVersion="1.0"
44
xmlns="http://schemas.microsoft.com/GroupPolicy/2006/07/PolicyDefinitions">
55
<displayName>WinGet-AutoUpdate</displayName>
66
<description>WinGet-AutoUpdate GPO Management</description>

Sources/Winget-AutoUpdate/WAU-Installer-GUI.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ Add-Type -AssemblyName PresentationFramework
381381
Start-PopUp "Starting..."
382382

383383
#Set config
384-
$null = cmd /c ''
384+
$null = & "$env:WINDIR\System32\cmd.exe" /c ""
385385
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
386386
$Script:ProgressPreference = "SilentlyContinue"
387387
$Script:ErrorActionPreference = "SilentlyContinue"

Sources/Winget-AutoUpdate/Winget-Upgrade.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Get-ChildItem -Path "$($Script:WorkingDir)\functions" -File -Filter "*.ps1" -Dep
99
<# MAIN #>
1010

1111
# Config console output encoding
12-
$null = cmd /c '';
12+
$null = & "$env:WINDIR\System32\cmd.exe" /c ""
1313
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8;
1414
$Script:ProgressPreference = [System.Management.Automation.ActionPreference]::SilentlyContinue;
1515

Sources/Winget-AutoUpdate/config/WAU-MSI_Actions.ps1

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,19 +58,19 @@ function Install-WingetAutoUpdate {
5858
$tasktriggers += New-ScheduledTaskTrigger -AtLogOn
5959
}
6060
if ($WAUconfig.WAU_UpdatesInterval -eq "Daily") {
61-
$tasktriggers += New-ScheduledTaskTrigger -Daily -At $WAUconfig.WAU_UpdatesAtTime
61+
$tasktriggers += New-ScheduledTaskTrigger -Daily -At $WAUconfig.WAU_UpdatesAtTime -RandomDelay $WAUconfig.WAU_UpdatesTimeDelay
6262
}
6363
elseif ($WAUconfig.WAU_UpdatesInterval -eq "BiDaily") {
64-
$tasktriggers += New-ScheduledTaskTrigger -Daily -At $WAUconfig.WAU_UpdatesAtTime -DaysInterval 2
64+
$tasktriggers += New-ScheduledTaskTrigger -Daily -At $WAUconfig.WAU_UpdatesAtTime -DaysInterval 2 -RandomDelay $WAUconfig.WAU_UpdatesTimeDelay
6565
}
6666
elseif ($WAUconfig.WAU_UpdatesInterval -eq "Weekly") {
67-
$tasktriggers += New-ScheduledTaskTrigger -Weekly -At $WAUconfig.WAU_UpdatesAtTime -DaysOfWeek 2
67+
$tasktriggers += New-ScheduledTaskTrigger -Weekly -At $WAUconfig.WAU_UpdatesAtTime -DaysOfWeek 2 -RandomDelay $WAUconfig.WAU_UpdatesTimeDelay
6868
}
6969
elseif ($WAUconfig.WAU_UpdatesInterval -eq "BiWeekly") {
70-
$tasktriggers += New-ScheduledTaskTrigger -Weekly -At $WAUconfig.WAU_UpdatesAtTime -DaysOfWeek 2 -WeeksInterval 2
70+
$tasktriggers += New-ScheduledTaskTrigger -Weekly -At $WAUconfig.WAU_UpdatesAtTime -DaysOfWeek 2 -WeeksInterval 2 -RandomDelay $WAUconfig.WAU_UpdatesTimeDelay
7171
}
7272
elseif ($WAUconfig.WAU_UpdatesInterval -eq "Monthly") {
73-
$tasktriggers += New-ScheduledTaskTrigger -Weekly -At $WAUconfig.WAU_UpdatesAtTime -DaysOfWeek 2 -WeeksInterval 4
73+
$tasktriggers += New-ScheduledTaskTrigger -Weekly -At $WAUconfig.WAU_UpdatesAtTime -DaysOfWeek 2 -WeeksInterval 4 -RandomDelay $WAUconfig.WAU_UpdatesTimeDelay
7474
}
7575
$taskUserPrincipal = New-ScheduledTaskPrincipal -UserId S-1-5-18 -RunLevel Highest
7676
$taskSettings = New-ScheduledTaskSettingsSet -Compatibility Win8 -StartWhenAvailable -AllowStartIfOnBatteries -DontStopIfGoingOnBatteries -ExecutionTimeLimit 03:00:00
@@ -182,6 +182,7 @@ function Install-WingetAutoUpdate {
182182
}
183183
}
184184

185+
185186
function Uninstall-WingetAutoUpdate {
186187

187188
Write-Host "### Uninstalling WAU started! ###"

Sources/Winget-AutoUpdate/functions/Get-WingetOutdatedApps.ps1

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
function Get-WingetOutdatedApps {
44

5-
Param(
6-
[Parameter(Position=0,Mandatory=$True,HelpMessage="You MUST supply value for winget repo, we need it")]
7-
[ValidateNotNullorEmpty()]
8-
[string]$src
9-
)
5+
Param(
6+
[Parameter(Position = 0, Mandatory = $True, HelpMessage = "You MUST supply value for winget repo, we need it")]
7+
[ValidateNotNullorEmpty()]
8+
[string]$src
9+
)
1010
class Software {
1111
[string]$Name
1212
[string]$Id
@@ -15,7 +15,13 @@ Param(
1515
}
1616

1717
#Get list of available upgrades on winget format
18-
$upgradeResult = & $Winget upgrade --source $src | Where-Object { $_ -notlike " *" } | Out-String
18+
try {
19+
$upgradeResult = & $Winget upgrade --source $src | Where-Object { $_ -notlike " *" } | Out-String
20+
}
21+
catch {
22+
Write-ToLog "Error while recieving winget upgrade list: $_" "Red"
23+
$upgradeResult = $null
24+
}
1925

2026
#Start Conversion of winget format to an array. Check if "-----" exists (Winget Error Handling)
2127
if (!($upgradeResult -match "-----")) {

Sources/Winget-AutoUpdate/functions/Test-Network.ps1

Lines changed: 19 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,16 @@
22

33
function Test-Network {
44

5-
#Init
5+
# Init
66
$timeout = 0
77

88
#Test connectivity during 30 min then timeout
99
Write-ToLog "Checking internet connection..." "Yellow"
1010

1111
try {
1212
$NlaRegKey = "HKLM:\SYSTEM\CurrentControlSet\Services\NlaSvc\Parameters\Internet"
13-
$ncsiHost = Get-ItemPropertyValue -Path $NlaRegKey -Name ActiveWebProbeHost
14-
$ncsiPath = Get-ItemPropertyValue -Path $NlaRegKey -Name ActiveWebProbePath
13+
$ncsiHost = Get-ItemPropertyValue -Path $NlaRegKey -Name ActiveWebProbeHost
14+
$ncsiPath = Get-ItemPropertyValue -Path $NlaRegKey -Name ActiveWebProbePath
1515
$ncsiContent = Get-ItemPropertyValue -Path $NlaRegKey -Name ActiveWebProbeContent
1616
}
1717
catch {
@@ -20,7 +20,7 @@ function Test-Network {
2020
$ncsiContent = "Microsoft Connect Test"
2121
}
2222

23-
While ($timeout -lt 1800) {
23+
while ($timeout -lt 1800) {
2424
try {
2525
$ncsiResponse = Invoke-WebRequest -Uri "http://$($ncsiHost)/$($ncsiPath)" -UseBasicParsing -UserAgent ([Microsoft.PowerShell.Commands.PSUserAgent]::Chrome); # DevSkim: ignore DS137138 Insecure URL
2626
}
@@ -31,67 +31,60 @@ function Test-Network {
3131
if (($ncsiResponse) -and ($ncsiResponse.StatusCode -eq 200) -and ($ncsiResponse.content -eq $ncsiContent)) {
3232
Write-ToLog "Connected !" "Green"
3333

34-
#Check for metered connection
35-
[void][Windows.Networking.Connectivity.NetworkInformation, Windows, ContentType = WindowsRuntime]
36-
$cost = [Windows.Networking.Connectivity.NetworkInformation]::GetInternetConnectionProfile().GetConnectionCost()
34+
# Check for metered connection
35+
try {
36+
[void][Windows.Networking.Connectivity.NetworkInformation, Windows, ContentType = WindowsRuntime]
37+
$cost = [Windows.Networking.Connectivity.NetworkInformation]::GetInternetConnectionProfile().GetConnectionCost()
3738

38-
if ($cost.ApproachingDataLimit -or $cost.OverDataLimit -or $cost.Roaming -or $cost.BackgroundDataUsageRestricted -or ($cost.NetworkCostType -ne "Unrestricted")) {
39+
$networkCostTypeName = [Windows.Networking.Connectivity.NetworkCostType]::GetName(
40+
[Windows.Networking.Connectivity.NetworkCostType],
41+
$cost.NetworkCostType
42+
)
43+
}
44+
catch {
45+
Write-ToLog "Could not evaluate metered connection status - skipping check." "Gray"
46+
return $true
47+
}
3948

49+
if ($cost.ApproachingDataLimit -or $cost.OverDataLimit -or $cost.Roaming -or $cost.BackgroundDataUsageRestricted -or ($networkCostTypeName -ne "Unrestricted")) {
4050
Write-ToLog "Metered connection detected." "Yellow"
4151

4252
if ($WAUConfig.WAU_DoNotRunOnMetered -eq 1) {
43-
4453
Write-ToLog "WAU is configured to bypass update checking on metered connection"
4554
return $false
46-
4755
}
4856
else {
49-
5057
Write-ToLog "WAU is configured to force update checking on metered connection"
5158
return $true
52-
5359
}
54-
5560
}
5661
else {
57-
5862
return $true
59-
6063
}
61-
6264
}
6365
else {
64-
6566
Start-Sleep 10
6667
$timeout += 10
6768

68-
#Send Warning Notif if no connection for 5 min
6969
if ($timeout -eq 300) {
70-
#Log
7170
Write-ToLog "Notify 'No connection' sent." "Yellow"
7271

73-
#Notif
7472
$Title = $NotifLocale.local.outputs.output[0].title
7573
$Message = $NotifLocale.local.outputs.output[0].message
7674
$MessageType = "warning"
7775
$Balise = "Connection"
7876
Start-NotifTask -Title $Title -Message $Message -MessageType $MessageType -Balise $Balise
7977
}
80-
8178
}
82-
8379
}
8480

85-
#Send Timeout Notif if no connection for 30 min
8681
Write-ToLog "Timeout. No internet connection !" "Red"
8782

88-
#Notif
8983
$Title = $NotifLocale.local.outputs.output[1].title
9084
$Message = $NotifLocale.local.outputs.output[1].message
9185
$MessageType = "error"
9286
$Balise = "Connection"
9387
Start-NotifTask -Title $Title -Message $Message -MessageType $MessageType -Balise $Balise
9488

9589
return $false
96-
97-
}
90+
}

0 commit comments

Comments
 (0)