Start a new topic

Powershell Scripting usage

 

Hello everyone, I was wondering if any of you actually use the PowerShell modules for scripting? (You would think so, because they have been downloaded several thousand times.) I'm having trouble with the existing documentation; I find it incomplete and not beginner-friendly. I was wondering if anyone has real scripts from which I could learn? I also tried to create a simple script using my trusted AI assistants, which retrieves and opens a document from a royal server, but even there I'm already failing.

Please let me know if you have any tips.


Hi Gabriel,


we actually have a documentation regarding this here:

https://www.royalapps.com/go/kb-ts-win-powershellmodule-samples


and here:

https://www.royalapps.com/go/help-ts-powershellmodule-gettingstarted


If you have any questions feel free to create a new support ticket here, and we'll try to assist:

https://www.royalapps.com/go/support-ticket-new


I hope this helps!


Best regards,

Christoph




You may also check out the github repo here for more real-world samples:

https://www.royalapps.com/go/toolbox

 Hello everyone, thank you for your feedback.

To pick up on both Christoph's and Stefan's feedback the following response:

"we actually have documentation on this here:
https://www.royalapps.com/go/kb-ts-win-powershellmodule-samples"

Yes! but actually no. doesn't help me at least. The version of the mudule in the article is different from the latest release.
I wanted to use the "Open-RoyalServerDocument" or the Out function. From my point of view, this is not addressed in any of the samples.

"and here:
https://www.royalapps.com/go/help-ts-powershellmodule-gettingstarted"


Here, too, I lack an example of how to use the function, in the respective examples I only find: "$doc = Open-RoyalServerDocument -RoyalServer $server -RoyalServerDocument $serverDocument" but this is not very helpful, because the interesting places (i.e. $server) are not explained how they should be used.

Specifically, I get the following error message: Cannot bind parameter 'RoyalServer'. Cannot convert the "192.168.0.1" value of type "System.String" to type "RoyalDocumentLibrary.RoyalManagementEndpoint".
How do I enter a value here that RoyalDocument can interpret?

In general, it seems to me that it is not intended to process documents on a RoyalServerStore from a client via Powershell? But then why is there the corresponding cmd-let? This assumption is supported for me once again when I only find examples to edit local documents.

"If you have any questions feel free to create a new support ticket here, and we'll try to assist:
https://www.royalapps.com/go/support-ticket-new"
Should I create a ticket for this request or continue to discuss it in the forum, I imagine I'm not the only one who has already asked themselves these questions, and then it would be advantageous if this conversation is visible to everyone, wouldn't it?

"You may also check out the github repo here for more real-world samples:
https://www.royalapps.com/go/toolbox"

I have already read these, they are also very interesting, but they don't help me much at the moment.

Regards Gabriel

Hi Gabriel,


not sure if you've already seen the response in the ticket you opened earlier this week. Here's the sample which demonstrates how to open a Royal Server document:

Install-Module -Name RoyalDocument.PowerShell -Force
Import-Module RoyalDocument.PowerShell

#create a store object
$store = New-RoyalStore -UserName "ScriptUser"

# create a new document
$doc = New-RoyalDocument -Store $store -FileName "D:\tmp\Test.rtsz" -Name "documentname"

# create a Royal Server object
$endpoint = New-RoyalObject -folder $doc -Type RoyalManagementEndpoint -Name "Royal Server Object Test" -Description "description"

# https://docs.royalapps.com/r2021/scripting/objects/gateways/royalmanagementendpoint.html
Set-RoyalObjectValue -Object $endpoint -Property "RoyalServerHost" -Value "<server here>"
Set-RoyalObjectValue -Object $endpoint -Property "RoyalServerCredentialMode" -Value 1
Set-RoyalObjectValue -Object $endpoint -Property "RoyalServerUsername" -Value "<user name here>"
Set-RoyalObjectValue -Object $endpoint -Property "RoyalServerPassword" -Value "<password here>"

# save the doc?
# Out-RoyalDocument -Document $doc

# this gets a list of all available royal server docs
$rsdocs = Get-RoyalServerDocument -RoyalServer $endpoint -IgnoreCertificateWarning
# i'm opening the 4th item in the list. you might want to filter by id, name or so
$rsdoc = Open-RoyalServerDocument -RoyalServer $endpoint -RoyalServerDocument $rsdocs[3] -IgnoreCertificateWarning


We will see that we get a sample like this into our docs as well.


Regards,
Stefan

Login or Signup to post a comment