microsoft / ReportingServicesTools

Reporting Services Powershell Tools
MIT License
458 stars 213 forks source link

Get-RsRestItemAccessPolicy Role Bug? #335

Open MuggleHerder opened 3 years ago

MuggleHerder commented 3 years ago

Do you want to request a feature or report a bug? Report a Bug What is the current behavior? When running Get-RsRestItemAccessPolicy and using the correct syntax and exporting to CSV ( 1000's of reports), If a Identity has multiple roles the output comes back as "System.Object[]". I also tried this not only on the home Level, but as well on a specific Folder Level and Report Level with same results If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem. Step 1. Install-Module -Name ReportingServicesTools Step 2. $ReportPortalUri = 'http://REPORTPORTALURL/Reports' Get-RsRestItemAccessPolicy -ReportPortalUri $ReportPortalUri -RsItem "/" -Recurse | Export-Csv -Path C:\Temp\SSRS_TEST.csv

What is the expected behavior? I would expect to see all the roles that a Identity has assigned to it. Which versions of Powershell and which OS are affected by this issue? Did this work in previous versions of our scripts? SQL 2017 SSRS 14.0.600.906 Windows 2016 PS 5.1 ReportingServices Tool ->0.0.6.5

First Version I have tried this on

vytux-com commented 2 years ago

I don't believe there is anything wrong with what gets outputted by ReportingServicesTools here. If you | Format-Table -AutoSize instead of exporting to CSV you will see the correct data.

Now if you wanted to output this data into a CSV you could use Powershell to handle the data in the way you want, e.g. if you wanted the multiple values to be ; separated you could do something like this:

 Get-RsRestItemAccessPolicy -ReportPortalUri $ReportPortalUri -RsItem "/" -Recurse | foreach-object {
   [PSCustomObject] @{
     "Identity"=$_.Identity
     "Path" = $_.Path
     "TypeName" = $_.Type
     "Roles" = $_.Roles -join ';'
     "ParentSecurity" = $_.ParentSecurity
   }
 } | Export-Csv -Path C:\Temp\SSRS_TEST.csv