Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

using rsrestsession with Write-RsRestCatalogItem

$
0
0
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

Viewing all articles
Browse latest Browse all 21975


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>