1

I'm trying to determine how difficult it is to automate a process using Powershell. Using Report Builder, I created a simple report with a single parameter, the ID number of the list I use as a datasource. I can open the report, enter the ID and I get the report. Is it possible to use Powershell to run the same report, pass in the ID, export the report as a PDF and save it in the Shared Documents library in the same site?

1
  • Why don't you just use SharePoint to schedule your report?
    – MikeAinOz
    Apr 25, 2016 at 21:50

1 Answer 1

1

Maybe something like this? Essentially what this guy is doing is using the WinForms Report Builder dll to pull in the SSRS report and export it using code.

You can upload the file once you have it through code that looks similar to this (referenced from Todd Klindt):

$Web = Get-SPWeb $WebURL 
$List = $Web.GetFolder($DocLibName) 
$Files = $List.Files
$Files.Add($DocLibName +"/" + $FileName,$PDFExportedFile.OpenRead(),$false)
3
  • I actually found that same article and was able to partially get my result. I was hoping to do it all within SharePoint, but this allowed me to actually generate the PDF to a file on my hard drive. I could go this route if I could then add that physical file to a designated SP library using Powershell.
    – Badkneecap
    Apr 25, 2016 at 18:37
  • actually see my edit.
    – Mike
    Apr 25, 2016 at 19:11
  • alternatively, you can download the report by using powershell to access the report via url msdn.microsoft.com/en-us/library/ms154040.aspx
    – Shawn
    Apr 27, 2016 at 1:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.