title: Download file using powershell
body: <p>I am trying to download file from the SharePoint portal.</p>
  
  <p>I was able to login successfully and open the file, but unable to download the file via script. Could you please advise. Thanks.</p>
  
  <pre><code>$username= user_name
  $password = password
  $url = "https://share.mycompany.com/"
  
  $ie = New-Object -ComObject InternetExplorer.Application
  $ie.Visible = $true
  $ie.navigate($url)
  
  
  Start-Sleep -Milliseconds 10000
  
  $ie.Document.getElementByID("Ecom_User_ID").value = $username
  $ie.Document.getElementByID("Ecom_Password").value = $password
  $ie.document.getElementById("loginBtn").click()
  
  Start-Sleep -Milliseconds 10000
  $source = "https://share.mycompany.com/sites/department/SomeExcelFile.xlsx"
  
  $ie.navigate($source)
  $obj = new-object -com WScript.Shell
  $obj.AppActivate('Internet Explorer')
  $obj.SendKeys('s')
  $obj.SendKeys('{Enter}')
  
  </code></pre>