PowerShell – Retrieve a SSRS Report in a .NET GUI

May 5, 2019

Ever wanted to create you Offline Reporting Engine based on SSRS using PowerShell !

The objective is to run the RDL reports server side and display in .NET GUI client side.


You first need to download the .NET Assemblies using the SSRS redistributables.

Download here :

2008 / 2010 / 2012 or 2015 for a newer version see here


The solution is based on .Net Scripting in PowerShell using a GUI.

REMOTE processing mode :

# [System.Reflection.Assembly]::LoadWithPartialName(“Microsoft.ReportViewer.WinForms”)
Add-Type -Path "C:\WINDOWS\assembly\GAC_MSIL\Microsoft.ReportViewer.WinForms\\Microsoft.ReportViewer.WinForms.dll"

#Windows.Forms for viewing dialog box
# [void][System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")
Add-Type -AssemblyName "System.Windows.Forms"

# for credentials, if needed
# [void][System.Reflection.Assembly]::LoadWithPartialName("System.Net")
Add-Type -AssemblyName System.Net

$credential = Get-Credential

$rv = New-Object Microsoft.Reporting.WinForms.ReportViewer;
$rv.ServerReport.ReportServerCredentials.NetworkCredentials = $credential

$rv.ProcessingMode = "Remote"

$rv.ServerReport.ReportServerUrl = "http://YourServer/Reportserver"
$rv.ServerReport.ReportPath = "/YourReportName”

$rv.Height = 600;
$rv.Width = 800;

# Show as Dialog Using Windows Form
# Create a new form
$form = New-Object Windows.Forms.Form;

# Form Properties
$form.Height = 610;
$form.Width= 810;

# Export to Excel
#now let’s try exporting to Excel
$mimeType = $null;
$encoding = $null;
$extension = $null;
$streamids = $null;
$warnings = $null;

$bytes = $rv.ServerReport.Render("Excel”, $null,
[ref] $mimeType,
[ref] $encoding,
[ref] $extension,
[ref] $streamids,
[ref] $warnings);
$file = "C:\Temp\SampleReport.xls”;
$fileStream = New-Object System.IO.FileStream($file,
$fileStream.Write($bytes, 0, $bytes.Length);

#l Open up our excel application
$excel = New-Object -comObject Excel.Application
$excel.visible = $true;
$excel.Workbooks.Open($file) | Out-Null;

# Export to PDF
$bytes = $rv.ServerReport.Render("PDF”, $null,
[ref] $mimeType,
[ref] $encoding,
[ref] $extension,
[ref] $streamids,
[ref] $warnings);
$file2 = "C:\Temp\SampleReport.pdf”;
$fileStream = New-Object System.IO.FileStream($file2,
$fileStream.Write($bytes, 0, $bytes.Length);

The result is the report in your own GUI that runs locally and is processed centrally, when you use REMOTE

If the report has Parameters it will prompt you to enter them just like in the Web Form.


After the GUI is close the script will be EXPORT the content to EXCEL and PDF too.

You will have the options to EXPORT to all supported formats, or add your own extension if you are working server side.


LOCAL processing mode :

Most interesting is that you can run the Report Viewer Control in LOCAL processing mode !

Which means that you can create a Local Reporting Engine that runs the RDL reports from you client in a PowerShell GUI


And additionally you can add any kind of .Net support Data Source, like in this case an SQLite database !

Which is not supported by server side SSRS…

How cool is that ! Surprised smile

For more info see here

Happy Scripting Smile



SSRS – How to export a csv without header and more…

April 24, 2019

1. Create an New EXPORT Device using CSV without HEADERS

By default it exports the HEADER info as well …



Solution :

Go to the Reporting server config file.

C:\Program Files\Microsoft SQL Server\MSRS10_50.MSSQLSERVER\Reporting Services\ReportServer\rsreportserver.config

Make a copy for backup reason and add this to the RENDER section



<Extension Name="CSV (No Header)" Type="Microsoft.ReportingServices.Rendering.DataRenderer.CsvReport,Microsoft.ReportingServices.DataRendering">
   <Name Language="en-us">CSV No Header</Name>


Next restart the Reporting Service again and test it …

Connect to the Web Server to see the result.



2. Ever wanted to create a report where the EXPORT FIELDS would be different from the Report VIEW.


Solution :

Go to the field and set the Property DataElementOutput to NoOutput



This makes that these fields will NOT be EXPORTED  Smile


3. Print a label on the FOOTER page


Solution :

Select a label field you want to have printed on the last page only.


Enjoy !!

SSRS – SharePoint Lists Default VIEW

March 22, 2018

Once you connect to a SharePoint List you will always get connected to the list using the DEFAULT VIEW.

Which might not be what you want because it can be a FILTERED View. And therefore not showing you all the records you want.


1. Go to DataSet –> Query


2. Apply a Filter


Strangely enough if you DO NOT Apply a filter in the Query Designer. It will fetch the data using the DEFAULT VIEW set in SharePoint ???

So basically in order to get ALL the DATA, you need to SET a FILTER that covers the whole range in your data set.

Very contradictory approach Confused smile

Enjoy !

SSRS – SharePoint Lists HTML Tags

March 22, 2018

If you are working a lot using SSRS against SharePoint Lists.

You will see that some lists that contain Text are not displayed properly… Sad smile

See Example :


The first column shows the raw output with all the HTML Tags.

While the second column shows you the proper output you need for the report.


1. You first need to add a PLACEHOLDER in the column


Two times a LEFT click in the field and next a RIGHT click.

2. Secondly put in the field that has the HTML text, and choose HTML as MARKUP TYPE



Enjoy !

QlikView – Access Data from SSRS

March 3, 2015

Since QlikView can’t access certain data sources like MS Analysis Services (SSAS) or other exotic data sources (SAP NetWeaver BI, Hyperion, TERADATA) natively.

We can fall back on the perfect middleware for this being MS SQL Reporting services


The approach is a simple as can be. Setup an SSRS server (can even be the MS SQL Express (Free) Edition & SSRS add-on)

The SSRS report server has natively a web service interface, exposing a SOAP and URL Interface.

Next develop your SSRS reports (which can handle multi data sources in 1 report Smile)


Like for example a SharePoint List combined with an Oracle database, or anything else.

Simular to PowerPivot that can access an SSRS Data Source. We can do the same with QlikView.

Use a Web File connection as Data Source


Fill in your report URL link and add the rs:Format=XML parameter to get an XML output from you report


If all goes well you will get the Report XML output and see the SSRS TABLIX and FIELDS Smile


That’s it, now you are ready to build your QlikView GUI

Once you know this technique you can as well use this to access an SSRS in the MS Azure cloud.Winking smile


SharePoint – SSRS Web Part Parameter Issue

January 31, 2015

We had an annoying problem with a published SSRS report in SharePoint that uses a Parameter.

Most likely this appears only in combination with a external data source like an ODBC connection that retrieves data from a data source not within the current domain ?

This strange ‘bug’ I would call it so far is not showing when your run the report from within the Report Designer, but only from within SharePoint.

So I suspect that this is a malfunction in the SSRS front end Web Part.

Problem :

When selecting the first time a parameter in the report, it returns all the filtered data. But when selecting a new parameter value, for the second time, it returns a blank page ? And the parameter box jumps down.


Solution :

After debugging with trial and errors, we found out that if you add a Default Value, in the parameter field, the problem is solved.


If you get the parameter values from a different Dataset, you can also specify the Default Value using the Get Values from a Query option. But this is not needed to make it work.

Just give any valid default value in the Specify Values field will do the job as well.


Again, this problem is not occurring in the Report Designer itself?

So the SharePoint users are happy to see that this annoyance is gone Smile

PowerPivot – Connect to an SSRS Report

September 17, 2014

SSRS is a very nice reporting platform that comes along with MS SQL.

Using the free Report Builder client you can make some very nice reports and publish or schedule them to run on your intranet.

But what if you want to reuse valuable information in the reports ?

Well we can you use MS PowerPivot to access the data over the internet on you client.

Open PP and choose the in the menu From Report.

Next point to the URL on you Reporting Intranet or SharePoint if you are running in mixed mode.


When you click next it will grab the TABLIX data grid in your report.


As easy as that.

This is how the bits and pieces fall together in your MS BI environment. Smile