I know this topic has been covered comprehensively on SO and several other forums by now. I'm hoping someone can shed some light on my issue. TL;DR: I can get this script to see if a URL is valid when the server uses Tls1.2, but not a URL where the server uses Tls1.2 and Tls1.3.
I'm writing a script for a lowest common denominator audience (Win7, .NET Framework 4.8, WMF 3.0/4.0, all updates installed as of 12/2022) and part of the script checks to see if a given KB update has a support page and/or a MS update catalog download link using Invoke-WebRequest
.
I can successfully test
https://www.catalog.update.microsoft.com/Search.aspx?q=KB2506143
to see if it has any download buttons.- This particular search result does not have any download buttons/links.
- Initially I received a Could not create SSL/TLS secure channel error, but resolved this by including this in the script:
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor [System.Net.SecurityProtocolType]::Tls12
I cannot test
https://support.microsoft.com/en-us/kb/2506143
to see if the URL exists or not. I still receive the Could not create SSL/TLS secure channel error.- When I use
[Net.ServicePointManager]::SecurityProtocol = 'Tls13'
I get a different exception (expected on Win7):
System.Net.WebException: The underlying connection was closed: An unexpected error occurred on a receive. ---> System.ComponentModel.Win32Exception: The client and server cannot communicate, because they do not possess a common algorithm
- When I use
Every other combination of SecurityProtol produces the SSL/TSL secure channel error message.
support.microsoft.com looks like it uses Tls 1.2 and Tls 1.3.
www.catalog.update.microsoft.com looks like it uses Tls 1.2 only.
I'm open to other methods simply to check if a URL exists in PowerShell 3.0/4.0 but have come up empty.
I'm certain I'm missing a crucial detail in terms of comparing both SSL reports. I assumed that I would be able to use Invoke-WebRequest
using Windows 7 and Tls1.2 (with .NET 4.8 installed and after registry edits, etc) with both websites, but only the catalog URL is working for now. I tried a Win8.1 VM for kicks and got the same results - catalog URL works but the support URL still fails with the SSL/TLS secure channel error. This works on Windows 10 for me though.
What am I overlooking or missing (other than there are people/companies using Win7 that shouldn't be)?