在PowerShell中调用SSRS报告并注册SSRS事件日志条目

时间:2017-05-23 14:29:50

标签: powershell reporting-services

需要:用于调用SSRS报告(SSRS 2012)的PowerShell脚本,以便在SSRS的ExecutionLog3中查看网络呼叫时显示为常规交互式请求(SSRS' s log DB view。。

问题:我已经使用以下脚本进行修补,试图找出强制SSRS服务器记录呼叫所需的参数,就像它来自人类一样/浏览器。这个脚本工作正常。我连接了& amp;得到所有3种方法的响应,但SSRS根本没有记录它。如果我手动在IE / Chrome中调用相同的报告 - SSRS会相应地记录它。正确。

我在Chrome中使用了F12工具,看看我是否能找到一些实际上正在执行log-registration-req的JS代码,唉 - 对我来说太高级了。

思想?

    # My AdventureWorks Sales Order Detail (.rpl) requires no parameters.

$RS1 = $null
$RS2 = $null
$RS3 = $null

# Try using the direct URL of the report approach 
$Uri1 = 'http://reportstest.domain.com/home/report/AdventureWorks-Test/Sales%20Orders/Sales%20Order%20Detail.rdl'
# Try using the ReportViewer.aspx followed by path & variables approach
$Uri2 = 'http://reportstest.domain.com/Service/Pages/ReportViewer.aspx?%2fAdventureWorks-Test%2fSales+Orders%2fSales+Order+Detail&rc:Command=Render'
# Try using the Service approach
$Uri3 = 'http://reportstest.domain.com/Service?/AdventureWorks-Test%2fSales+Orders%2fSales+Order+Detail'

# Try each Uri to see if we create an entry in SSRS's ExecutionLog3
$RS1 = Invoke-WebRequest -Uri $Uri1 -UseDefaultCredentials -DisableKeepAlive
$RS2 = Invoke-WebRequest -Uri $Uri2 -UseDefaultCredentials -DisableKeepAlive
$RS3 = Invoke-WebRequest -Uri $Uri3 -UseDefaultCredentials -DisableKeepAlive

# See the response for each attempt, check for '200'
$RS1.StatusCode
$RS2.StatusCode
$RS3.StatusCode

0 个答案:

没有答案