I need to download a Salesforce report, previously I have been doing some manual work by clicking buttons,
I recently found out that I can just add a few parameters at the end of the url to have chrome download it without clicking export
# Link to the report
https://mycompanydomain.com/00O3md123456789qf
# when I add these to the end of the link and paste it to chrome, chrome will download directly
https://mycompanydomain.com/00O3md123456789qf?export=1&enc=UTF-8&xf=csv
Is there a way to automate it with Powershell?
I tried to use Invoke Webrequest
but it does not work the way I wanted, it does not download the actual file but returns the response status.
# get Salesforce Data
$url = "https://mycompanydomain.com/00O3md123456789qf?export=1&enc=UTF-8&xf=csv"
$output = ".\salesforce.csv"
$start_time = Get-Date
Invoke-WebRequest -Uri $url -OutFile $output
Write-Output "Time taken: $((Get-Date).Subtract($start_time).Seconds) second(s)"