I need to load a https file. I use wget
with option --no-check-certificate
. It runs perfectly if started by the ISE-debugger. It even runs perfectly if I started in the cmd-console: ./myScript.ps1
. But as soon as I set the Task Scheduler to start my script I get:
--2016-02-07 19:44:01-- https://www.dailyfx.com/calendar/ Resolving www.dailyfx.com... 104.87.22.147 Connecting to www.dailyfx.com|104.87.22.147|:443... connected. WARNING: cannot verify www.dailyfx.com's certificate, issued by `/C=US/O=GeoTrust Inc./CN=GeoTrust SSL CA - G3': Unable to locally verify the issuer's authority. WARNING: certificate common name `fxcm.com' doesn't match requested host name `www.dailyfx.com'. HTTP request sent, awaiting response... 403 Forbidden 2016-02-07 19:44:01 ERROR 403: Forbidden.
Before calling I set the $ArgList
and then I call wget
:
$urlDFx = "https://www.dailyfx.com/calendar/"
$argList = "$urlDFx -O $rawDFx -o $logDFx --no-check-certificate"
$wg = Start-Process wget -wait -NoNewWindow -PassThru -ArgumentList $argList
The other variables are various local files.
Again, it works in the ISE and the CMD console but not if started by the Task Scheduler. The other part of the scripts are executed without any problem: I did another http-file and parse it.
What can I do?