set default TLS version to 1.2

This commit is contained in:
2024-11-06 10:07:39 -05:00
parent 6dc5a4efce
commit 7a91bce87a
+30
View File
@@ -1149,6 +1149,36 @@ Function Set-OutlookProfilePrompt () {
Write-Output "Available Outlook profiles:`n${Profiles}"
}
# Function to install and run script using Powershell 7
# Provided by j.mcbride from https://community.syncromsp.com/t/powershell-7-2/7425/5
Function Start-ScriptInPowershell7 () {
# Check for required PowerShell version (7+)
If (!($PSVersionTable.PSVersion.Major -ge 7)) {
Try {
# Install PowerShell 7 if missing
If (!(Test-Path "$env:SystemDrive\Program Files\PowerShell\7")) {
Write-Output 'Installing PowerShell version 7...'
Invoke-Expression "& { $(Invoke-RestMethod https://aka.ms/install-powershell.ps1) } -UseMSI -Quiet"
}
# Refresh PATH
$Env:Path = [System.Environment]::GetEnvironmentVariable('Path', 'Machine') + ';' + [System.Environment]::GetEnvironmentVariable('Path', 'User')
# Restart script in PowerShell 7
pwsh -File "`"$PSCommandPath`"" @PSBoundParameters
}
Catch { Write-Error $_.Exception.Message }
Finally { Exit $LASTEXITCODE }
}
# Input the actual script below this line
}
# Upgrade default TLS version to 1.2
Try { [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 }
Catch { Write-Error $_.Exception.Message }
# Initial setup of the MSP management directories and log file
Setup-MSPDirectories
Setup-LogFile