From f3be48215dff22c0db349641b16036ac75bbef42 Mon Sep 17 00:00:00 2001 From: Neil White Date: Wed, 8 Jan 2025 07:51:23 -0800 Subject: [PATCH 1/4] Added TLS 1.3 support for PS Core --- GitHubCore.ps1 | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/GitHubCore.ps1 b/GitHubCore.ps1 index f869c4dc..e91642d9 100644 --- a/GitHubCore.ps1 +++ b/GitHubCore.ps1 @@ -315,7 +315,10 @@ function Invoke-GHRestMethod # Disable Progress Bar in function scope during Invoke-WebRequest $ProgressPreference = 'SilentlyContinue' - [Net.ServicePointManager]::SecurityProtocol=[Net.SecurityProtocolType]::Tls12 + if ($PSVersionTable.PSVersion -lt 7.0.0) + { + [Net.ServicePointManager]::SecurityProtocol=[Net.SecurityProtocolType]::Tls12 + } $result = Invoke-WebRequest @params @@ -582,7 +585,10 @@ function Invoke-GHRestMethod } finally { - [Net.ServicePointManager]::SecurityProtocol = $originalSecurityProtocol + if ($PSVersionTable.PSVersion -lt 7.0.0) + { + [Net.ServicePointManager]::SecurityProtocol = $originalSecurityProtocol + } } } From a53d6c1af2864deb75f1b5c529876c941f462b66 Mon Sep 17 00:00:00 2001 From: Neil White Date: Wed, 8 Jan 2025 08:44:12 -0800 Subject: [PATCH 2/4] Fixed PowerShell version comparison --- GitHubCore.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/GitHubCore.ps1 b/GitHubCore.ps1 index e91642d9..0d036098 100644 --- a/GitHubCore.ps1 +++ b/GitHubCore.ps1 @@ -315,7 +315,7 @@ function Invoke-GHRestMethod # Disable Progress Bar in function scope during Invoke-WebRequest $ProgressPreference = 'SilentlyContinue' - if ($PSVersionTable.PSVersion -lt 7.0.0) + if ($PSVersionTable.PSVersion -lt [version]"7.0.0") { [Net.ServicePointManager]::SecurityProtocol=[Net.SecurityProtocolType]::Tls12 } @@ -585,7 +585,7 @@ function Invoke-GHRestMethod } finally { - if ($PSVersionTable.PSVersion -lt 7.0.0) + if ($PSVersionTable.PSVersion -lt [version]"7.0.0") { [Net.ServicePointManager]::SecurityProtocol = $originalSecurityProtocol } From 6f1b15c2fd187729098543a1a2d4dab47ae1b050 Mon Sep 17 00:00:00 2001 From: Neil White Date: Wed, 8 Jan 2025 08:56:39 -0800 Subject: [PATCH 3/4] Changed double quotes to single-quotes Co-authored-by: Howard Wolosky --- GitHubCore.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GitHubCore.ps1 b/GitHubCore.ps1 index 0d036098..bbe2452c 100644 --- a/GitHubCore.ps1 +++ b/GitHubCore.ps1 @@ -585,7 +585,7 @@ function Invoke-GHRestMethod } finally { - if ($PSVersionTable.PSVersion -lt [version]"7.0.0") + if ($PSVersionTable.PSVersion -lt [Version]'7.0.0') { [Net.ServicePointManager]::SecurityProtocol = $originalSecurityProtocol } From e8356b1b79a5b68ffc805fc564f2e61262ee110d Mon Sep 17 00:00:00 2001 From: Neil White Date: Wed, 8 Jan 2025 08:57:04 -0800 Subject: [PATCH 4/4] Added proper spacing Co-authored-by: Howard Wolosky --- GitHubCore.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GitHubCore.ps1 b/GitHubCore.ps1 index bbe2452c..c8b0e11b 100644 --- a/GitHubCore.ps1 +++ b/GitHubCore.ps1 @@ -317,7 +317,7 @@ function Invoke-GHRestMethod if ($PSVersionTable.PSVersion -lt [version]"7.0.0") { - [Net.ServicePointManager]::SecurityProtocol=[Net.SecurityProtocolType]::Tls12 + [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 } $result = Invoke-WebRequest @params