I have a Windows Server 2012R2 with powershell 4.
A sql job issues a
Invoke-WebRequest https://someserver/file.xml -OutFile c:/tmp/data.xml"
It fails with ssl error, even if I follow
Powershell Invoke-WebRequest Fails with SSL/TLS Secure Channel and prepend [Net.ServicePointManager]::SecurityProtocol = "tls12, tls11, tls"
or the other variations.
Is powershell 4 too old?
Should I try installing Wowershell 6 or 7 from https://github.com/PowerShell/PowerShell/releases ?
Will that be invoked by the sqljob, or should it be specified somewhere/somehow that it's supposed to run v7 instead of v4?
PS: I know "Windows Server 2012 R2 entered mainstream support on November 25, 2013, though, but its end of mainstream is January 9, 2018, and end of extended is January 10, 2023" but upgrading is not an option right now.
EDIT
I installed powershell 5.1, it didn't change
Major Minor Build Revision
----- ----- ----- --------
5 1 14409 1005
and do
[Net.ServicePointManager]::SecurityProtocol = "tls12, tls11, tls"
But still get
Invoke-WebRequest : The request was aborted: Could not create SSL/TLS secure channel.
EDIT 2
PS C:\Users\leif> $PSVersionTable
Name Value
---- -----
PSVersion 5.1.14409.1005
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.14409.1005
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1