Files

22 lines
731 B
PowerShell

try {
$URL = "https://google.com"
$URL_Test = Invoke-WebRequest -UseBasicParsing $_URL | Select-Object -ExpandProperty StatusCode
}
catch {
Write-Output "URL does accept current TLS settings:"
[Net.ServicePointManager]::SecurityProtocol
Write-Output "`n"
$Question = Read-host "Do you want to add TLS version 1.2 now? [y/n]"
switch ($Question.ToLower()) {
{ @("y", "yes") -contains $_ } {
#Adds TLS version 1.2 for communication
[Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12
}
default {
Write-Output "Please update TLS version, exiting script."
Start-Sleep 5
Exit
}
}
}