Monday, August 15, 2016

XML to JSON and JSON to XML converter online

XML to JSON and JSON to XML converter online

C# - comparing version numbers

I wasted some time this morning writing my own version comparer, trying to write something short and smart that would be able to compare, if, for example,

version 4.56.7 is greater than version 4.3.2.1


turns out C# already has a lib for that :

https://msdn.microsoft.com/en-us/library/system.version.aspx

It can take up to 4 dot-separated components - major, minor, build, and revision.

Tuesday, August 9, 2016

SSRS Reporting Services - Site Settings security with PowerShell

Handy little PowerShell to automate adding a User or a Group to Site Settings of SSRS 2008 R2:

$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