B
B
brar2021-04-07 15:19:37
PowerShell
brar, 2021-04-07 15:19:37

Why is the script on the server throwing an error?

Win Server 2016.
In the PowerShell terminal I do:

powershell -Command "(new-object net.webclient).DownloadString('https://api.telegram.org/bot9872429879724:sdfsfdsfedfgdfgrfeve/sendMessage?chat_id=mydididididid&text=mytext')"

Mistake:
Исключение при вызове "DownloadString" с "1" аргументами: "Запрос был прерван: Не удалось создать защищенный канал SSL/TLS."
строка:1 знак:1
+ (new-object net.webclient).DownloadString('https://api.telegram.org/b ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : WebException


In windows 10, the same script works fine.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
azarij, 2021-04-07
@brar

try like this:

powershell -Command "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; (new-object net.webclient).DownloadString('https://api.telegram.org/bot9872429879724:sdfsfdsfedfgdfgrfeve/sendMessage?chat_id=mydididididid&text=mytext')"

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question