Last active
November 16, 2017 16:23
-
-
Save cporteou/947c7687b388789bd29de33a1b88578a to your computer and use it in GitHub Desktop.
Exports all perms from root folder ("/" for ALL) of SSRS to csv file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#--------------------------------------------- | |
# Author: Craig Porteous | |
# @cporteous | |
# Synopsis: List out all SSRS (native mode) | |
# folders & their security policies | |
# & output dataset to CSV file | |
#--------------------------------------------- | |
Clear-Host | |
$ReportServerUri = 'http://REPORTSERVERURL/ReportServer/ReportService2010.asmx?wsdl' | |
$InheritParent = $true | |
$SSRSroot = "/" | |
$rsPerms = @() | |
$rsResult = @() | |
$rsProxy = New-WebServiceProxy -Uri $ReportServerUri -UseDefaultCredential | |
#List out all subfolders under the parent directory and Select their "Path" | |
$folderList = $rsProxy.ListChildren($SSRSroot, $InheritParent) | Select -Property Path, TypeName | Where-Object {$_.TypeName -eq "Folder"} | Select Path | |
#Iterate through every folder | |
foreach($folder in $folderList) | |
{ | |
#Return all policies on this folder | |
$Policies = $rsProxy.GetPolicies( $folder.Path, [ref] $InheritParent ) | |
#For each policy, add details to an array | |
foreach($rsPolicy in $Policies) | |
{ | |
[array]$rsResult = New-Object PSObject -Property @{ | |
"Path" = $folder.Path; | |
"GroupUserName" = $rsPolicy.GroupUserName; | |
"Role" = $rsPolicy.Roles[0].Name | |
} | |
$rsPerms += $rsResult | |
} | |
} | |
#Output array to csv named after instance URL | |
$rsPerms | Export-Csv -Path "C:\TEMP\output.csv" -NoTypeInformation |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment