Skip to content

Instantly share code, notes, and snippets.

@cporteou
Last active November 16, 2017 16:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cporteou/947c7687b388789bd29de33a1b88578a to your computer and use it in GitHub Desktop.
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
#---------------------------------------------
# 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