windowspowershelltls1.2activeperlactivestate

Exception calling "DownloadString" with "1' argument<s>


I'm newbie to web development learning by myself. I'm not a cs student. I'm following a book called HTML5 in easy steps. There is a lesson called "Building input forms" which uses free Abyss Personal Edition web server and activeperl scripts. I want to install activeperl on my machine. I'm on windows 8.1. Activestate site doesn't offer .exe file anymore instead it offers cli installation for windows 10. site says windows 8.1 also be supported. I tried installing their cli program command for windows which is powershell -Command "& $([scriptblock]::Create((New-Object Net.WebClient).DownloadString('https://platform.activestate.com/dl/cli/install.ps1')))".

Then I got this error message.[screenshot attached] screenshot

Then I googled the exception and found that powershell wasn't configured to older versions of windows prior to 2019 to work with tls 1.2. https://github.com/dotnet/docs/issues/6873

Any tips on how to work around this problem???


Solution

  • Note:


    Enable TLS 1.2 as follows, in a ;-separated statement before the .DownloadString() call:

    powershell -Command "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; & ([scriptblock]::Create((New-Object Net.WebClient).DownloadString('https://platform.activestate.com/dl/cli/install.ps1')))"
    

    Note: Since you're only using the PowerShell instance for a single download known to use TLS 1.2, the above enables TLS 1.2 only.


    If you also had to preserve the originally enabled protocols:

    PowerShell v5+ syntax:

    powershell -Command "[Net.ServicePointManager]::SecurityProtocol += 'Tls12'; & ([scriptblock]::Create((New-Object Net.WebClient).DownloadString('https://platform.activestate.com/dl/cli/install.ps1')))"
    

    PowerShell v4- syntax:

    powershell -Command "[Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12; & ([scriptblock]::Create((New-Object Net.WebClient).DownloadString('https://platform.activestate.com/dl/cli/install.ps1')))"