博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
ReportServer Tutorial
阅读量:5149 次
发布时间:2019-06-13

本文共 5340 字,大约阅读时间需要 17 分钟。

This Document is a walk trough of how to set up a Report Server For newbies

SoftWare Environment

SQLServer Express 2014

  1. .

  2. When you install the SQLServer 2014, make sure if report server is checked. it is checked defaultly.

  3. Open Reporting Services Configuration Manager just like SQLServer Manager Studio. There are two URLs needed to be noted.

    that is WebServiceURL and ReportManagerURL. The second one is used to manager you report template. The first One is used to generating the
    report for client like winform ReportViewer.

  4. By Default, we need to open IE with runAsAdministrator feature to access to the manager website. if we hope to bypass this limit, we can follow this to assign the necessary privilege.


Manager Report Server with PowerShell

  1. instance a object of ReportServer
$ReportUrl = "http://xxx/ReportServer/ReportService2010.asmx?wsdl"$rs = New-WebServiceProxy -Uri $reportUrl -UseDefaultCredential -Namespace "SSRS"
  1. Now we can rock over it by using this

  2. refer link

Code Snap:

param(    [Parameter(Mandatory=$false)]    [string]$ReportServerUrL = "http://xxx:xxx/ReportServer/ReportService2010.asmx?wsdl",   # [string]$ReportServerUrL = "http://localhost/ReportServer/ReportService2010.asmx?wsdl",    [Parameter(Mandatory=$false)]    [string]$LocalRDLFilePath = "xxx\Reports\SSRSReports",    [Parameter(Mandatory=$false)]    [string]$ReportFolderPath = "/AgencyNoticeReports",    [Parameter(Mandatory=$false)]    [string]$SharedDataSourcePath = "/AgencyNoticeReports/Agency")Function Get-ReportServerInstance {     param(     [Parameter(Mandatory=$true)]     [string]$ReportUrl,     [Parameter(Mandatory=$false)]     [string]$Namespace     )      return New-WebServiceProxy -Uri $ReportUrl -UseDefaultCredential -Namespace $Namespace } Function Delete-ItemsByPath {     param(         [Parameter(Mandatory=$true)]         [object]$RS,         [Parameter(Mandatory=$true)]         [string]$Path,         [Parameter(Mandatory=$false)]         [bool]$IsRecurse=$false     )     $RS.DeleteItem($Path)     if($IsRecurse){$RS.ListChildren($Path,$IsRecurse) | %{$RS.DeleteItem($_.Path)}} } Function Upload-ReportToRemoteServer {     param(         [Parameter(Mandatory=$true)]         [object]$RS,         [Parameter(Mandatory=$true)]         [string]$RDLFilePath,         [Parameter(Mandatory=$true)]         [string]$ReportServerPath     )     Resolve-Path -Path $RDLFilePath     $RDLFile = Get-Item -Path $RDLFilePath     $reportName = [System.IO.Path]::GetFileNameWithoutExtension($RDLFile.Name)     $bytes = [System.IO.File]::ReadAllBytes($RDLFile.FullName)     $warnings=$null     $report = $rs.CreateCatalogItem(        "Report",         # Catalog item type        $reportName,      # Report name        $ReportServerPath,# Destination folder        $true,            # Overwrite report if it exists?        $bytes,           # .rdl file contents        $null,            # Properties to set.        [ref]$warnings)   # Warnings that occured while uploading.    $warnings | %{  Write-Output ("Warning: {0}" -f $_.Message)} } Function Create-ReportFolder {     Param(         [Parameter(Mandatory=$true)]         [object]$RS,         [Parameter(Mandatory=$true)]         [string]$FolderName,         [Parameter(Mandatory=$false)]         [string]$ParentFolderPath="/"     )     $RS.CreateFolder($FolderName,$ParentFolderPath,$null) } Function Test-ItemByPath {     Param(         [Parameter(Mandatory=$true)]         [object]$RS,         [Parameter(Mandatory=$true)]         [string]$Path     )     Return ($Rs.ListChildren("/",$true) | ?{$_.Path -eq $Path}) -ne $null } Function Update-DataSource {     Param(         [Parameter(Mandatory=$true)]         [object]$RS,         [Parameter(Mandatory=$true)]         [string]$SharedDataSourcePath,         [Parameter(Mandatory=$true)]         [string]$ReportFolderPath     )     $RS.ListChildren($ReportFolderPath,$false) |?{$_.TypeName -eq "Report"} | %{           $referencedDataSourceName = (@($rs.GetItemReferences($_.Path, "DataSource")))[0].Name            # Change the datasource for the report to $SharedDataSourcePath            # Note that we can access the types such as DataSource with the prefix             # "SSRS" only because we specified that as our namespace when we             # created the proxy with New-WebServiceProxy.            $dataSource = New-Object SSRS.DataSource            $dataSource.Name = $referencedDataSourceName                  # Name as used when designing the Report            $dataSource.Item = New-Object SSRS.DataSourceReference            $dataSource.Item.Reference = $SharedDataSourcePath # Path to the shared data source as it is deployed here.            $rs.SetItemDataSources($_.Path, [SSRS.DataSource[]]$dataSource)    } }$Rs = Get-ReportServerInstance -ReportUrl $ReportServerUrL  -Namespace "SSRS"if((Test-ItemByPath -RS $RS -Path $ReportFolderPath) -eq $false){    Create-ReportFolder -RS $RS -FolderName $ReportFolderPath.remove(0,1)}Resolve-Path $LocalRDLFilePathGet-ChildItem -Path $LocalRDLFilePath | ?{$_.Name -like "*.rdl"} | %{Upload-ReportToRemoteServer -RS $RS -RDLFilePath $_.FullName -ReportServerPath $ReportFolderPath }Update-DataSource -RS $RS -SharedDataSourcePath $SharedDataSourcePath -ReportFolderPath $ReportFolderPath

转载于:https://www.cnblogs.com/kongshu-612/p/6509960.html

你可能感兴趣的文章
HDU 6370(并查集)
查看>>
BZOJ 1207(dp)
查看>>
PE知识复习之PE的导入表
查看>>
HDU 2076 夹角有多大(题目已修改,注意读题)
查看>>
洛谷P3676 小清新数据结构题(动态点分治)
查看>>
九校联考-DL24凉心模拟Day2T1 锻造(forging)
查看>>
Attributes.Add用途与用法
查看>>
L2-001 紧急救援 (dijkstra+dfs回溯路径)
查看>>
javascript 无限分类
查看>>
spring IOC装配Bean(注解方式)
查看>>
[面试算法题]有序列表删除节点-leetcode学习之旅(4)
查看>>
SpringBoot系列五:SpringBoot错误处理(数据验证、处理错误页、全局异常)
查看>>
kubernetes_book
查看>>
OpenFire 的安装和配置
查看>>
侧边栏广告和回到顶部
查看>>
https://blog.csdn.net/u012106306/article/details/80760744
查看>>
海上孤独的帆
查看>>
error: more than one device and emulator 问题解决
查看>>
Django 学习
查看>>
Linux-socket的close和shutdown区别及应用场景
查看>>