Merge pull request #675 from AndrewDemski-ad-gmail-com/main

Minor code fixes
pull/678/head
Romain 2024-09-01 14:21:02 +02:00 committed by GitHub
commit eabb1bf57a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 15 additions and 13 deletions

View File

@ -12,8 +12,9 @@ function Test-ModsPath ($ModsPath, $WingetUpdatePath, $AzureBlobSASURL) {
# If path is URL # If path is URL
if ($ExternalMods -like "http*") { if ($ExternalMods -like "http*") {
# enable TLS 1.2 and TLS 1.1 protocols # ADD TLS 1.2 and TLS 1.1 to list of currently used protocols
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12, [Net.SecurityProtocolType]::Tls11 [Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12
[Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls11
#Get Index of $ExternalMods (or index page with href listing of all the Mods) #Get Index of $ExternalMods (or index page with href listing of all the Mods)
try { try {
$WebResponse = Invoke-WebRequest -Uri $ExternalMods -UseBasicParsing $WebResponse = Invoke-WebRequest -Uri $ExternalMods -UseBasicParsing

View File

@ -7,18 +7,19 @@ function Test-Network {
#Test connectivity during 30 min then timeout #Test connectivity during 30 min then timeout
Write-ToLog "Checking internet connection..." "Yellow" Write-ToLog "Checking internet connection..." "Yellow"
try {
$NlaRegKey = "HKLM:\SYSTEM\CurrentControlSet\Services\NlaSvc\Parameters\Internet"
$ncsiHost = Get-ItemPropertyValue -Path $NlaRegKey -Name ActiveWebProbeHost
$ncsiPath = Get-ItemPropertyValue -Path $NlaRegKey -Name ActiveWebProbePath
$ncsiContent = Get-ItemPropertyValue -Path $NlaRegKey -Name ActiveWebProbeContent
} catch {
$ncsiHost = "www.msftconnecttest.com"
$ncsiPath = "connecttest.txt"
$ncsiContent = "Microsoft Connect Test"
}
While ($timeout -lt 1800) { While ($timeout -lt 1800) {
try {
$ncsiHost = Get-ItemPropertyValue -Path "HKLM:\SYSTEM\CurrentControlSet\Services\NlaSvc\Parameters\Internet" -Name ActiveWebProbeHost
$ncsiPath = Get-ItemPropertyValue -Path "HKLM:\SYSTEM\CurrentControlSet\Services\NlaSvc\Parameters\Internet" -Name ActiveWebProbePath
$ncsiContent = Get-ItemPropertyValue -Path "HKLM:\SYSTEM\CurrentControlSet\Services\NlaSvc\Parameters\Internet" -Name ActiveWebProbeContent
} catch {
$ncsiHost = "www.msftconnecttest.com"
$ncsiPath = "connecttest.txt"
$ncsiContent = "Microsoft Connect Test"
}
try { try {
$ncsiResponse = Invoke-WebRequest -Uri "http://$($ncsiHost)/$($ncsiPath)" -UseBasicParsing -UserAgent ([Microsoft.PowerShell.Commands.PSUserAgent]::Chrome) $ncsiResponse = Invoke-WebRequest -Uri "http://$($ncsiHost)/$($ncsiPath)" -UseBasicParsing -UserAgent ([Microsoft.PowerShell.Commands.PSUserAgent]::Chrome)
} catch { } catch {