Skip to content

Commit 9deb4e3

Browse files
Merge pull request #34 from DarrenWhite99/TLSTesting
TLS Handling Updates
2 parents c505c57 + b453b1c commit 9deb4e3

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

LabTech.psm1

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,11 @@ Add-Type -Debug:$False @"
6363
}
6464
"@
6565
[System.Net.ServicePointManager]::CertificatePolicy = New-Object TrustAllCertsPolicy
66-
#Enable TLS 1.2
67-
if ([Net.ServicePointManager]::SecurityProtocol.ToString().Split(',').Trim() -notcontains 'Tls12') {
68-
$securityProtocol=@()
69-
$securityProtocol+=[Net.ServicePointManager]::SecurityProtocol
70-
$securityProtocol+=[Net.SecurityProtocolType]3072
71-
[Net.ServicePointManager]::SecurityProtocol=$securityProtocol
72-
}
66+
#Enable TLS, TLS1.1, TLS1.2 in this session if they are available
67+
IF([Net.SecurityProtocolType]::Tls) {[Net.ServicePointManager]::SecurityProtocol=[Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls}
68+
IF([Net.SecurityProtocolType]::Tls11) {[Net.ServicePointManager]::SecurityProtocol=[Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls11}
69+
IF([Net.SecurityProtocolType]::Tls12) {[Net.ServicePointManager]::SecurityProtocol=[Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12}
70+
7371
#region [Functions]-------------------------------------------------------------
7472

7573
Function Get-LTServiceInfo{
@@ -433,7 +431,7 @@ Function Start-LTService{
433431
Write-Warning "There was an issue killing the following process: $proc"
434432
Write-Warning "This generally means that a 'protected application' is using this port."
435433
$newPort = [int]$port + 1
436-
if($newPort > 42009) {$newPort = 42000}
434+
if($newPort -gt 42009) {$newPort = 42000}
437435
Write-Warning "Setting tray port to $newPort."
438436
New-ItemProperty -Path "HKLM:\Software\Labtech\Service" -Name TrayPort -PropertyType String -Value $newPort -Force -WhatIf:$False -Confirm:$False | Out-Null
439437
}#End Catch

0 commit comments

Comments
 (0)