Get programmatically User Roles and Permissions in SSRS 2008

I use SSRS 2008 on Windows 2008 R2.

How can I get the user list of roles and permissions (Reports Manager Roles such as Browser, Content Manager, etc) using Powershell or C# (programmatically)?

Any suggestions ?

Notes:

"Folder Settings" area where you can specify roles for a user - "Content Manager," "Publisher," "Browser," "Report Builder," and "My Reports"

SSRS has 2 security/role sections available in the web GUI: Folder Settings and Site Settings.

Upvotes: 3

Views: 3672

Answers (1)

Kiquenet
Kiquenet

Reputation: 14976

I try with my script powershell.

References: http://www.bi-rootdata.com/2015/03/list-ssrs-items-permissions-using.html by Anup Agrawal comment

Usage:

$ScriptDirectory = Split-Path $MyInvocation.MyCommand.Path

Clear-Host
Write-Host $ScriptDirectory
Write-Host $env:COMPUTERNAME -ForegroundColor Yellow
Write-Host $env:USERNAME -ForegroundColor Yellow

$ReportServerUri = 'http://localhost/ReportServer/ReportService2005.asmx'
$InheritParent = $true
$SourceFolderPath = '/'
$outSSRSSecurity=@()

$Proxy = New-WebServiceProxy -Uri $ReportServerUri -Namespace SSRS.ReportingService2005 -UseDefaultCredential
$items = $Proxy.ListChildren($sourceFolderPath, $true)|Select-Object Type, Path, Name|Where-Object {$_.type -eq "Folder"};

foreach($item in $items)
{
    #Write-Host $item

    if ($item.Name -ne "TestsCustomCDR")
    {
     #continue;
    }
        Write-Host $item.Path  -ForegroundColor Yellow
        Write-Host $item.Name -ForegroundColor Green

        Add-Member -InputObject $item -MemberType NoteProperty -Name PolicyGroupUserName -Value '';

        foreach($policy in $Proxy.GetPolicies($item.path, [ref]$InheritParent))
        {
             Write-Host $policy.GroupUserName
             $objtemp=$item.PsObject.Copy();
             $objtemp.PolicyGroupUserName=$policy.GroupUserName;
             $outSSRSSecurity += $objtemp;
             $objtemp.reset;
        }
}

$outSSRSSecurity|Export-csv SSRSSecurityOutput.csv -NoTypeInformation;

Upvotes: 3

Related Questions