本文介绍了将rsrestsession与Write-RsRestCatalogItem一起使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的所有人,以b
$ b我尝试与Powershell一起部署报告。 I 已安装RS模块。

如果我使用-Credential'domain\xxx'并在提示时输入我的密码,它可以正常工作。



但是现在,我想自动化进程,因此,使用WebSession参数而不是Crendential。



$
这就是我正在做的事情:
$


$用户名='domain \ xxxx'



$密码='xxx'



$ pass = ConvertTo-SecureString -AsPlainText $ Password -Force $ SecureString = $ pass

$ MySecureCreds = New-Object -TypeName System.Management .Automation.PSCredential -ArgumentList $ Username,$ SecureString

$ session = New-RsRestSession -ReportPortalUri https:// myserver / reports -Credential $ MySecureCreds





会话创建良好(密码错误时收到错误)。



现在我运行:



$
Write-RsRestCatalogItem -ReportPortalUri'https:// myserver / reports'-Path" D:\ xxxx xxx.rdl" -RsFolder" / My Reports" -WebSession $ session



我得到:



System.Exception:创建目录项失败:远程服务器返回错误:(401)
$




我错了什么?





提前付款。

问候,

Xavier

解决方案

Dear all,

i try to deploy a report with Powershell. I  installed RS module.
It works fine if i use -Credential 'domain\xxx' and enter my password when prompting.

But now, I would like to automate process, and so, use WebSession argument instead of Crendential.


here is what I'm doing:

$Username = 'domain\xxx'

$Password = 'xxx'

$pass = ConvertTo-SecureString -AsPlainText $Password -Force $SecureString = $pass
$MySecureCreds = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $Username,$SecureString
$session = New-RsRestSession -ReportPortalUri https://myserver/reports -Credential $MySecureCreds


The session is well created (receive error if bad password).

Now I run:


Write-RsRestCatalogItem -ReportPortalUri 'https://myserver/reports' -Path "D:\xxx\xxx.rdl" -RsFolder "/My Reports" -WebSession $session

I got:

System.Exception: Failed to create catalog item: The remote server returned an error: (401)


What I'm wrong ?


Thanks in advance.
regards,
Xavier

解决方案


这篇关于将rsrestsession与Write-RsRestCatalogItem一起使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-29 08:34