Attempting to download a .csv file from the net automatically each day.
I've so far setup a string $date, to use in the URL (if thats right).
Changed the TLS from 1.0 to 1.2
Make webrequest to the server, save output to file.
I just now need the $date to automatically change the URL.
Anyone know of an easy way to do this? Or do I completely need to redo the script?
Cheers,
$date = Get-Date
[System.Net.ServicePointManager]::SecurityProtocol -bor
[System.Net.SecurityProtocolType]::Tls12
$params = @{
'Uri' = @"https://website.net/v1/exportstation=32&buffer=daily&type=data&fileType=csv&grap hType=degreeDays&$(
'start={0:yyyy-MM-dd}&end={1:yyyy-MM-dd}' -f @($date.AddDays(-1), $date)
)&from=0|7&to=30|2&yearRanges=$($date.Year)
"@
'OutFile' = "$Env:USERPROFILE\Desktop\File.csv"
}