$rs = New-WebServiceProxy -uri "http://server/reportserver/ReportService2010.asmx?WSDL" -UseDefaultCredential -namespace "ReportingService2010" -class Reporting
$existingpolicies = $rs.GetSystemPolicies()
$Policy = New-Object -TypeName "ReportingService2010.Policy"
$Roles = @()
$Role = New-Object -TypeName "ReportingService2010.Role"
$Role.Name = "System User"
$Roles += $Role
$Policy.Roles = $Roles
$Policy.GroupUserName = "DOMAIN\USERORGROUP"
$PolicyAlreadyExists = $false
$existingpolicies | Foreach-Object{
if ($_.GroupUserName -eq "DOMAIN\USERORGROUP")
{$PolicyAlreadyExists = $true} }
$Policies = @($existingpolicies)
$Policies += $Policy
if(-not $PolicyAlreadyExists)
{
$rs.SetSystemPolicies($Policies)
}
based on https://social.technet.microsoft.com/Forums/sqlserver/en-US/ea8824fb-e1c4-4266-9e73-ef00a6c0a6cd/site-settings-security-using-rss-scripts?forum=sqlreportingservices
No comments:
Post a Comment