how to download a file (report) form local intranet with login credentials

This topic contains 7 replies, has 3 voices, and was last updated by  Derrick Swinarsky 11 months, 2 weeks ago.

  • Author
    Posts
  • #52955

    anand anand
    Participant

    If anybody know how to script this below task

    My daily task is to download a excel report form our intranet, the thing is i need to click 2 to 3 links to get the file in seperate window. in that case how can i edit this script...

  • #52961

    Daniel Krebs
    Moderator

    Do you have a script already which does not work for you?

    • #52963

      anand anand
      Participant

      Hi daniel,

      No, i dont create. But when looking for such script. i came across this below one:

      #Download SubInACL.msi to Desktop
      Get-FileAndExtract 'http://download.microsoft.com/download/1/7/d/17d82b72-bc6a-4dc8-bfaa-98b37b22b367/subinacl.msi' "$([Environment]::GetFolderPath("Desktop"))"

      #Download and extract the contents of SysinternalSuite.zip to Desktop\SysInternalSuite (folder SysInternalSuite is created)
      Get-FileAndExtract 'http://download.sysinternals.com/files/SysinternalsSuite.zip' "$([Environment]::GetFolderPath("Desktop"))"

      #Download and extract the contents of WorkSmartGuides.zip to Desktop\WorkSmartGuides (no folder is created since .zip already contains folder)
      Get-FileAndExtract 'http://download.microsoft.com/download/1/C/2/1C2D966E-F713-4A4F-9D5C-F7FB6E93E4B9/WorkSmartGuides.zip' "$([Environment]::GetFolderPath("Desktop"))"

  • #52965

    Daniel Krebs
    Moderator

    Ok. Please see if below is something you can work with.

    $uri = 'http://examples.com/Data.xlsx'
    $outFile = 'C:\TEMP\MyExcel.xlsx'
    $creds = Get-Credential
    
    Invoke-WebRequest -UseBasicParsing -Uri $uri -OutFile $outFile -Credential $creds -Verbose
    
  • #53134

    Daniel Krebs
    Moderator

    I believe that won't be something that PowerShell can solve for you because the report you're accessing through the web UI will be generated dynamically. You would need something like Selenium to drive a browser.

    Alternatives are:
    – Work with the team responsible for your BMC Remedy environment they are usually not bad people to export on their end and upload to an FTP/SFTP server of your choice.
    – Create an email subscription and get the report send into a shared mailbox. Assuming you have Exchange as email backend you could now use the Exchange Web Services API with PowerShell to detach the report from an email onto the disk.

    I hope that makes sense.

    P.S. I don't have access to an BMC Remedy system to help you further.

    • #53314

      Derrick Swinarsky
      Participant

      Shouldn't there also be a Rest API available for Remedy that would allow you to pull the information required???

  • #53141

    anand anand
    Participant

    Ohhh... i also her about the selinium.... ok let me discuss with my team....about this

    And thanks for your support.. daniel

You must be logged in to reply to this topic.