我正在编写一个PowerShell脚本,使用SSRS Web服务将大量报告部署到SQL Server Reporting Services 2008 R2.我对这种方法很满意,很容易创建一个新的部署文件夹并上传报告.以下是显示文件夹创建的代码片段:
$reportServerUri = "http://{0}/ReportServer/ReportService2005.asmx" -f $reportServerName
$proxy = New-WebServiceProxy -Uri $reportServerUri -Namespace SSRS.ReportingService2005 -Credential $credential
#Dont currently set any properties so set empty array of properties
$propertyArray = @()
$warnings = $proxy.CreateFolder($folderName, $folderParent, $propertyArray)
Run Code Online (Sandbox Code Playgroud)
但是,我也希望能够设置文件夹的权限,这是我有点卡住的地方.我想要复制的是,从Web UI中,我将选择文件夹的安全选项,并为角色添加用户\组.
我认为这可能是通过createFolder调用上的propertyArray来完成的,但是我还没有找到文档中的任何信息(探测现有属性并且看不到任何相关内容),我一直在看http:/ /msdn.microsoft.com/en-us/library/cc282788.aspx作为指导.所以在那里达到了死胡同.我认为可能有一种特定的方法来管理此级别的权限,但无法识别一个.
我正在使用ReportingService2005网络服务,我知道还有2010年的网络服务,但我还没能找到我正在寻找的东西.
有谁知道如何使用Web服务api向文件夹添加权限(并且可能是报告和共享数据源等其他对象的一致方法)?我认为必须有可能,因为Web UI允许您这样做.这不是一个PowerShell问题,而是用于管理权限的api.
更新 - 以下是似乎可以完成工作的代码片段.我需要完善这一点,因为它看起来像更新政策必须包括原始列表,所以我需要获得当前的政策,加上我的新政策,这和更新的完整列表.但我稍后会解决这个问题!
$Policies = $global:ssrsproxy.GetPolicies($ItemPath, [ref] $InheritsFromParent)
$PolicyAlreadyExists = $false
$Policies | Foreach-Object{ if ($_.GroupUserName -eq $GroupUserName)
{$PolicyAlreadyExists = $true} }
$Policies | Foreach-Object{ $_ | get-member }
if ($PolicyAlreadyExists){ …Run Code Online (Sandbox Code Playgroud) 我使用的脚本加载以下SQL Server 2008 R2 powershell插件
Add-PSSnapin SqlServerCmdletSnapin100
Add-PSSnapin SqlServerProviderSnapin100
Run Code Online (Sandbox Code Playgroud)
然后我像这样用户调用-sql:
Invoke-Sqlcmd -Query "select * from table" -ServerInstance xyz -Database abc -username xxxxxx -password yyyyyyy
Run Code Online (Sandbox Code Playgroud)
我正在使用方法在我们的数据库上运行许多升级脚本.我很高兴在我们的dev\test环境中使用它,但后来我在生产中尝试了它,结果发现我们在服务器配置上有所不同.在我们的prod服务器上,由于安全原因(显然是蠕虫攻击)而禁用了命名管道,而我们的DBA不想启用.
这是我得到的错误,研究表明它是一个命名管道问题 - 当我启用它们时开始工作.
INFO ERROR:Invoke-Sqlcmd:与服务器成功建立连接,但在登录过程中发生错误.(提供者:共享内存提供者,错误:0 - 管道的另一端没有进程.)
有谁知道是否有某种方法来切换我的脚本,以便它不需要命名管道?或者这是invoke-sqlcmd的内置连接方法,我需要更改大头钉(如果有任何建议).
我使用webdeploy来部署我的网站项目,其中包含一段时间以来一直使用的parameters.xml文件.到目前为止,我添加的参数都是元素属性,并且一切运行良好.但我试图让xpath正确更新applicationSettings元素值(而不是属性),并且如果我的糟糕的xpath技能被归咎于或者对参数文件的工作方式有误解,那么我将失败.
当我进行部署时,该字段未更新,它在部署期间编译良好且没有错误\警告.我希望能够将其设置为True或False.
所以我有以下参数字段
<parameter name="ShowExceptionCallStackOnErrorView" description="Display a call stack on the UI Error view - true for debug only." defaultValue="False" tags="">
<parameterEntry kind="XmlFile" scope="\\web.config$" match="/configuration/applicationSettings/abc.123.Properties.Settings/setting[@name='ShowExceptionCallStackOnErrorView']/value" />
</parameter>
Run Code Online (Sandbox Code Playgroud)
尝试匹配以下应用程序设置部分
<configuration>
<applicationSettings>
<abc.123.Properties.Settings>
<setting name="ShowExceptionCallStackOnErrorView" serializeAs="String">
<value>True</value>
Run Code Online (Sandbox Code Playgroud)
任何帮助将非常感激!