functions/Set-TlsEncryption.ps1
function Set-TlsEncryption { [CmdletBinding()] Param ( [Parameter(Mandatory = $false, Position = 0)] [string] $Tls = 'Tls12' ) Begin { $ErrorActionPreference = 'Stop' [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::$tls } Process { #[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::$tls $protocol = [Net.ServicePointManager]::SecurityProtocol if ($protocol -ne 'Tls12') { Write-PSFMessage -Level Warning "Tls not set to 1.2, will exit" Break(1) } } End { Write-PSFMessage -Level Host -Message "Using Tls1.2 encryption." Start-Sleep -Seconds 3 } } |