SSRS Reports

Ask your PowerShell-related questions, including questions on cmdlet development!
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This topic is 2 years and 3 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked
User avatar
localpct
Posts: 397
Last visit: Thu Oct 27, 2022 5:57 am

SSRS Reports

Post by localpct »

Hello, some of you might be aware of SQL Server Reporting Services (SSRS), I am able to read them using the ATOM report, but there is one that requires input of a PC Name, anyone familiar with this?
Snag_27695cf.png
Snag_27695cf.png (5.34 KiB) Viewed 2341 times
Here is a slimmed down version of the web address I want to 'POST' to
  1. https://server/ReportName&PCList=PC1&rs%3AParameterLanguage=&rs%3ACommand=Render&rs%3AFormat=ATOM&rc%3AItemPath=Tablix2

Here is how I view reports that don't require input
  1. $feed = 'https://server/ReportName&rs%3ACommand=Render&rs%3AFormat=ATOM&rc%3AItemPath=Tablix1'
  2. $data = Invoke-RestMethod -Uri $feed -UseDefaultCredentials
  3. $data.content.properties
Last edited by localpct on Thu Dec 09, 2021 7:39 pm, edited 1 time in total.
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: SSRS Reports

Post by jvierra »

That is just the name of the server you are connecting to. In the URL it is called "server" or it is defined by the report you are trying to execute so ask the report designer for what is being required.

Invoke-RestMethod cannot enter prompted values. SSRS Web access does not provide for that kind of automation. Post in a SQLServer forum for assistance on how to use the SSRS web API or ask teh developer of the report if this has been enabled and set up on the report server.
User avatar
localpct
Posts: 397
Last visit: Thu Oct 27, 2022 5:57 am

Re: SSRS Reports

Post by localpct »

If you notice within my code there is a PCList=PC1;
Within the page, after I search for the PC, there is the choice to .atomsvc file

It begs the question still, how can I achive whats on the docs site?
https://docs.microsoft.com/en-us/previo ... ed-reports
'Running Parameterized Reports
A report that contains input fields and a View Report button is a parameterized report. To view a parameterized report, you may need to provide values that are used to run the report.'

If you're unsure, no worries I'll find the correct forum
User avatar
localpct
Posts: 397
Last visit: Thu Oct 27, 2022 5:57 am

Re: SSRS Reports

Post by localpct »

User avatar
localpct
Posts: 397
Last visit: Thu Oct 27, 2022 5:57 am

Re: SSRS Reports

Post by localpct »

Page that led me to the ATOM feed
https://docs.microsoft.com/en-us/sql/re ... rver-ver15

Slimmed down code that someone can use, the select statement ( which I have 16 to do ) keeps it tidy.
  1. $PC = 'PC1'
  2. $feed = "https://server/restofurlPCList=$PC&rs%3aCommand=Render&rs%3aFormat=ATOM&rc%3aDataFeed=xAx0x1"
  3. $data = Invoke-RestMethod -Uri $feed -UseDefaultCredentials
  4. $PropertiesINeed = $data.content.properties | Select-Object @{
  5.         name = 'DisplayName'; expression = {
  6.             if ($_.displayname.null) { '' }
  7.             else { $_.displayname }
  8.         }
  9.     }
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: SSRS Reports

Post by jvierra »

T^hat does not generate a report to outpu but grabs the data that the report has acquired. It is not what you originally asked.
User avatar
localpct
Posts: 397
Last visit: Thu Oct 27, 2022 5:57 am

Re: SSRS Reports

Post by localpct »

I’d say I’m pretty close and even included an example of past working. Either way, I figured it out and that’s the important part.
This topic is 2 years and 3 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked