Currently I have this short piece of code. The URL https://dosomething.do
generates a .csv file. I can run the powershell code and in the shell I can see the content of the file. However the file itself is not downloaded. I would like to specify where to save it after a download. What are my options here?
$securepassword = ConvertTo-SecureString "xxx" -AsPlainText -Force
$credentials = New-Object System.Management.Automation.PSCredential("hxxx", $securepassword)
Invoke-WebRequest -Uri "https://dosomething.do" -Credential $credentials
Use the -OutFile
parameter of Invoke-WebRequest
:
Invoke-WebRequest -Uri "https://dosomething.do" -OutFile C:\some\path\to\yourfile.csv