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

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…

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

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”))”

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

HI daniel, thanks for your response… Pls see my realtime scenario.

step 1: i this is home page in which i will suppy credential (for security pupose i replaced my own site name as exapmple.com)

https://north.fin.example.com:8080/arsys/shared/login.jsp?/arsys/home

Step 2: After logged in, i will click on “Report” Link which will invoke seperate webpage(https://north.fin.exapmple.com:8080/arsys/forms/remprod/AR+System+Report+Console/Default+Administrator+View/?cacheid=c463911d)

step 3: In that seperate webpage i have to select the Report(this is drop down menu) “Created by me” and i will select appropriate report and download.

thanks in advance

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.

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

And thanks for your support… daniel

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