# Modify Microsoft Dynamics AX 2012 R3 SSRS configurations using PowerShell

Contents

reportManagerWebConfig.ps1

  1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16  #Modify the Report Server Web.config file. ie replace MSRS11.VAS with your folder name Set-ExecutionPolicy Unrestricted $webConfig = "C:Program FilesMicrosoft SQL ServerMSRS11.VASReporting ServicesReportManagerWeb.config"$currentDate = (get-date).tostring("mm_dd_yyyy-hh_mm_s") # month_day_year - hours_mins_seconds $backup =$webConfig + "_$currentDate"$doc = new-object System.Xml.XmlDocument $doc.Load($webConfig) #save a backup copy $doc.Save($backup) Write-Host "Backup saved as " + $backup$node = $doc.get_DocumentElement()."system.web".httpRuntime$attribute = $doc.CreateAttribute("maxRequestLength")$attribute.set_Value("100000") $node.SetAttributeNode($attribute ) $doc.Save($webConfig) Write-Host "1) Modified the Report Manager Web.config file" 

 RsReportServer.ps1

  1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127  #Modify the Report Server Web.config file. ie replace MSRS11.VAS with your folder name Set-ExecutionPolicy Unrestricted $version = "6.3.0.0"$webConfig = "C:Program FilesMicrosoft SQL ServerMSRS11.VASReporting ServicesReportServerRsReportServer.config" $currentDate = (get-date).tostring("mm_dd_yyyy-hh_mm_s") # month_day_year - hours_mins_seconds$backup = $webConfig + ".xml" #"_$currentDate" $doc = new-object System.Xml.XmlDocument$doc.Load($webConfig) #save a backup copy$doc.Save($backup) Write Write-Host "Backup saved as " +$backup #remove node "RSWindowsNegotiate" $node =$doc.documentElement.SelectSingleNode("//Configuration/Authentication/AuthenticationTypes/RSWindowsNegotiate") if ($node) { {$node.ParentNode.RemoveChild($node) Write Write-Host "RSWindowsNegotiate Removed" } #Add node "IsRdceEnabled"$nodeService = $doc.documentElement.SelectSingleNode("//Configuration/Service")$nodeIsRdceEnabled = $doc.documentElement.SelectSingleNode("//Configuration/Service/IsRdceEnabled") #Set to true if already exists, otherwise create the node if ($nodeIsRdceEnabled) { { $nodeIsRdceEnabled.InnerXml = "True" } else { if ($nodeService) { { $subnodeService =$doc.createElement("IsRdceEnabled") $subnodeService.InnerXml = "True"$nodeService.appendChild($subnodeService) Write Write-Host "IsRdceEnabled added" } } #Find Data$nodeCodeAxQuery = $doc.documentElement.SelectSingleNode("//Configuration/Extensions/Data/Extension[@Name='AXQUERY']") #Add Data Extension if (-not($nodeCodeAxQuery)) { { $nodeData =$doc.documentElement.SelectSingleNode("//Configuration/Extensions/Data") if ($nodeData) { {$nodeData.InnerXml = $nodeData.InnerXml + " " Write-Host "Data Extension added" } } #Find Extensions$nodeExtensions = $doc.documentElement.SelectSingleNode("//Configuration/Extensions")$nodeReportDefinitionCustomization = $doc.documentElement.SelectSingleNode("//Configuration/Extensions/ReportDefinitionCustomization") if (-not($nodeReportDefinitionCustomization)) { { #Add ReportDefinitionCustomization if ($nodeExtensions) { {$subnodeExt = $doc.createElement("ReportDefinitionCustomization")$subnodeExt.InnerXml = "" $nodeExtensions.appendChild($subnodeExt) Write Write-Host "ReportDefinitionCustomization added" } } else { $nodeAXRDCE=$doc.documentElement.SelectSingleNode("//Configuration/Extensions/ReportDefinitionCustomization/Extension [@Name='AXRDCE']") if (-not($nodeAXRDCE)) { {$nodeReportDefinitionCustomization.InnerXml = $nodeReportDefinitionCustomization.InnerXml + "" } }$doc.Save($webConfig) Write Write-Host "2) Modified the Report Server Web.config file" text some thing  ReportServerRsSrvPolicyConfig.ps1   1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82  #Instructions: Modify the Report Server Web.config file. ie replace MSRS11.VAS with your folder name # Modify version 6.3.0.0 for Dynamics AX 2012 Set-ExecutionPolicy Unrestricted$version = "6.3.0.0" $webConfig = "C:Program FilesMicrosoft SQL ServerMSRS11.VASReporting ServicesReportServerrssrvpolicy.config"$currentDate = (get-date).tostring("mm_dd_yyyy-hh_mm_s") # month_day_year - hours_mins_seconds $backup =$webConfig + ".xml" #"_$currentDate"$doc = new-object System.Xml.XmlDocument $doc.Load($webConfig) #save a backup copy $doc.Save($backup) Write Write-Host "Backup saved as " + $backup #Add SecurityClass$nodeAxSessionPermission = $doc.documentElement.SelectSingleNode("//configuration/mscorlib/security/policy/PolicyLevel/SecurityClasses/SecurityClass[@Name='AxSessionPermission']") if (-not($nodeAxSessionPermission)) { { $nodeSecurityClasses =$doc.documentElement.SelectSingleNode("//configuration/mscorlib/security/policy/PolicyLevel/SecurityClasses") if ($nodeSecurityClasses) { {$nodeSecurityClass = $doc.createElement("SecurityClass")$nodeSecurityClass.InnerXml = "" $nodeSecurityClasses.appendChild($nodeSecurityClass.FirstChild) Write Write-Host "SecurityClass added" } } #Add PermissionSet $nodeAxSessionPermissionSet =$doc.documentElement.SelectSingleNode("//configuration/mscorlib/security/policy/PolicyLevel/NamedPermissionSets/PermissionSet[@class='NamedPermissionSet' and @version='1' and @Name='AxSessionPermissionSet']") if (-not($nodeAxSessionPermissionSet)) { {$nodeNamedPermissionSets = $doc.documentElement.SelectSingleNode("//configuration/mscorlib/security/policy/PolicyLevel/NamedPermissionSets") if ($nodeNamedPermissionSets) { { $nodePermissionSet =$doc.createElement("PermissionSet") $nodePermissionSet.InnerXml = " "$nodeNamedPermissionSets.appendChild($nodePermissionSet.FirstChild) Write Write-Host "PermissionSet added" } } #Add CodeGroup$nodeAxStrongName = $doc.documentElement.SelectSingleNode("//configuration/mscorlib/security/policy/PolicyLevel/CodeGroup[@class='FirstMatchCodeGroup' and @version='1' and @PermissionSetName='Nothing']/CodeGroup[@class='UnionCodeGroup' and @version='1' and @PermissionSetName='FullTrust' and @Name='AX_Reports_Strong_Name']") if (-not($nodeAxStrongName)) { { $nodeCodeGroup =$doc.documentElement.SelectSingleNode("//configuration/mscorlib/security/policy/PolicyLevel/CodeGroup[@class='FirstMatchCodeGroup' and @version='1' and @PermissionSetName='Nothing']") if ($nodeCodeGroup) { {$subnodeCodeGroup = $doc.createElement("CodeGroup")$subnodeCodeGroup.InnerXml = " " $nodeCodeGroup.appendChild($subnodeCodeGroup.FirstChild) Write Write-Host "CodeGroup added" } } #Add nodeReportExpressionPermission #http://blogs.msdn.com/b/axsupport/archive/2012/02/02/microsoft-dynamics-ax-2012-reporting-extensions-error-system-security-permissions-environmentpermission-while-running-report.aspx $nodeReportExpressionPermission =$doc.documentElement.SelectSingleNode("//configuration/mscorlib/security/policy/PolicyLevel/CodeGroup[@class='FirstMatchCodeGroup' and @version='1' and @PermissionSetName='Nothing']/CodeGroup[@class='UnionCodeGroup' and @version='1' and @PermissionSetName='Execution' and @Name='Report_Expressions_Default_Permissions']") if ($nodeReportExpressionPermission) { {$attribute = $doc.CreateAttribute("PermissionSetName")$attribute.set_Value("FullTrust") $nodeReportExpressionPermission.SetAttributeNode($attribute ) } } $doc.Save($webConfig) Write Write-Host "3) Modified the Report Server rssrvpolicy.config file"