ARM64 workarounds
parent
c72349caa1
commit
08bd0bc60e
|
@ -3,7 +3,9 @@
|
|||
Function Get-WingetCmd {
|
||||
|
||||
#Get WinGet Path (if admin context)
|
||||
$ResolveWingetPath = Resolve-Path "$env:ProgramFiles\WindowsApps\Microsoft.DesktopAppInstaller_*_x64__8wekyb3d8bbwe" | Sort-Object { [version]($_.Path -replace '^[^\d]+_((\d+\.)*\d+)_.*', '$1') }
|
||||
# Includes Workaround for ARM64 (removed X64 and replaces it with a wildcard)
|
||||
$ResolveWingetPath = Resolve-Path "$env:ProgramFiles\WindowsApps\Microsoft.DesktopAppInstaller_*_*__8wekyb3d8bbwe" | Sort-Object { [version]($_.Path -replace '^[^\d]+_((\d+\.)*\d+)_.*', '$1') }
|
||||
|
||||
if ($ResolveWingetPath) {
|
||||
#If multiple version, pick last one
|
||||
$WingetPath = $ResolveWingetPath[-1].Path
|
||||
|
@ -29,7 +31,7 @@ Function Get-WingetCmd {
|
|||
#Log Winget installed version
|
||||
$WingetVer = & $Winget --version
|
||||
Write-Log "Winget Version: $WingetVer"
|
||||
|
||||
|
||||
return $true
|
||||
|
||||
}
|
||||
|
|
|
@ -1,55 +1,58 @@
|
|||
#Function to check connectivity
|
||||
|
||||
function Test-Network {
|
||||
|
||||
|
||||
#Init
|
||||
$timeout = 0
|
||||
|
||||
# Workaround for ARM64 (Access Denied / Win32 internal Server error)
|
||||
$ProgressPreference = 'SilentlyContinue'
|
||||
|
||||
#Test connectivity during 30 min then timeout
|
||||
Write-Log "Checking internet connection..." "Yellow"
|
||||
While ($timeout -lt 1800) {
|
||||
|
||||
$URLtoTest = "https://raw.githubusercontent.com/Romanitho/Winget-AutoUpdate/main/LICENSE"
|
||||
$URLcontent = ((Invoke-WebRequest -URI $URLtoTest -UseBasicParsing).content)
|
||||
|
||||
|
||||
if ($URLcontent -like "*MIT License*") {
|
||||
|
||||
|
||||
Write-Log "Connected !" "Green"
|
||||
|
||||
#Check for metered connection
|
||||
[void][Windows.Networking.Connectivity.NetworkInformation, Windows, ContentType = WindowsRuntime]
|
||||
$cost = [Windows.Networking.Connectivity.NetworkInformation]::GetInternetConnectionProfile().GetConnectionCost()
|
||||
|
||||
|
||||
if ($cost.ApproachingDataLimit -or $cost.OverDataLimit -or $cost.Roaming -or $cost.BackgroundDataUsageRestricted -or ($cost.NetworkCostType -ne "Unrestricted")) {
|
||||
|
||||
|
||||
Write-Log "Metered connection detected." "Yellow"
|
||||
|
||||
|
||||
if ($WAUConfig.WAU_DoNotRunOnMetered -eq 1) {
|
||||
|
||||
|
||||
Write-Log "WAU is configured to bypass update checking on metered connection"
|
||||
return $false
|
||||
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
|
||||
Write-Log "WAU is configured to force update checking on metered connection"
|
||||
return $true
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
return $true
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
Start-Sleep 10
|
||||
$timeout += 10
|
||||
|
||||
|
||||
#Send Warning Notif if no connection for 5 min
|
||||
if ($timeout -eq 300) {
|
||||
Write-Log "Notify 'No connection' sent." "Yellow"
|
||||
|
@ -59,11 +62,11 @@ function Test-Network {
|
|||
$Balise = "connection"
|
||||
Start-NotifTask $Title $Message $MessageType $Balise
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
#Send Timeout Notif if no connection for 30 min
|
||||
Write-Log "Timeout. No internet connection !" "Red"
|
||||
$Title = $NotifLocale.local.outputs.output[1].title
|
||||
|
|
Loading…
Reference in New Issue