【发布时间】:2019-11-22 12:49:48
【问题描述】:
我想将 SSRS 数据源凭据检索从使用以下凭据更改为不使用任何凭据,并且使用 powershell 并且脚本失败。
我想根据这篇文章将值“存储”更改为“无”: https://docs.microsoft.com/en-us/dotnet/api/reportservice2010.credentialretrievalenum?view=sqlserver-2016#ReportService2010_CredentialRetrievalEnum_None
这是我的代码:
$uri ='http://ServerName/ReportServer/ReportService2010.asmx?wsdl'
$reporting = New-WebServiceProxy -uri $uri -UseDefaultCredential -namespace "ReportingWebService"
$DataSources = $reporting.ListChildren('/', $true) | Where-Object {$_.Name -eq "DataSourceName"}
foreach($Object in $DataSources) {
$dataSource =$reporting.GetDataSourceContents($Object.path)
#$dataSource.CredentialRetrieval="None"
$dataSource.CredentialRetrieval=[ReportingWebService.CredentialRetrievalEnum]::None
$reporting.SetDataSourceContents($Object.path,$dataSource)
}
这是错误:
使用“2”参数调用“SetDataSourceContents”的异常:“字段 UserName 和 CredentialRetrieval 的值组合无效。---> Microsoft.ReportingServices.Diagnostics.Utilities.InvalidElementCombinationException:UserName 和 CredentialRetrieval 字段的值组合无效。” 在行:13 字符:4 + $reporting.SetDataSourceContents($Object.path,$dataSource) + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [], MethodInvocationException + FullyQualifiedErrorId : SoapException
【问题讨论】:
标签: powershell reporting-services