$file = "c:\temp\imp.txt"
Invoke-WebRequest -InFile $file -Method Post -ContentType 'multipart/form-data' 'https://api.telegram.org/botXXX/sendDocument?chat_id=1111111&document'
add-type @"
using System.Net;
using System.Security.Cryptography.X509Certificates;
public class TrustAllCertsPolicy : ICertificatePolicy {
public bool CheckValidationResult(
ServicePoint srvPoint, X509Certificate certificate,
WebRequest request, int certificateProblem) {
return true;
}
}
"@
[System.Net.ServicePointManager]::CertificatePolicy = New-Object TrustAllCertsPolicy