Getting Started

Getting Started

Scripting >

Installing the PowerShell Module

The PowerShell module is available for free on the PowerShell Gallery:


Install the latest module on your system using this command:


 Install-Module -Name RoyalDocument.PowerShell



The PowerShell module can be used on Windows, macOS and Linux (using PowerShell Core). There is no need to install Royal TS/X or to apply a license in order to use the PowerShell module. Simply install the module and import it in your scripts.


Using the RoyalDocument Commandlets

In order to work with the RoyalDocument PowerShell commandlets, you need to register them (import them) into your PowerShell session. Just issue the following command and you are good to go:


 Import-Module RoyalDocument.PowerShell


First Steps

Most of the RoyalDocument related objects are known from the Royal TS UI - e.g. RoyalDocument (a document), RoyalCredential (a credential),

RoyalFolder (a folder) etc. With the exception of the RoyalStore which is the base class that holds all references to open RoyalDocuments.

For a complete list of all available objects and properties can be found in the scripting reference.


A simple script that just opens a RoyalStore, adds a RoyalDocument, saves it and closes it looks like this:


 # create a new RoyalStore in memory

 $store = New-RoyalStore -UserName "michaelseirer"


 # create a new RoyalDocument with the new .rtsz format

 $newDocumentPath = "C:\Users\michaelseirer\Documents\new.rtsz"

 $newDocument = New-RoyalDocument -Name "Powershell TestDocument" -FileName $newDocumentPath -Store $store 


 # save it to disk

 Out-RoyalDocument -Document $newDocument



Working with Objects

Adding different objects to an open RoyalDocument is easy:


 $doc = New-RoyalObject -folder $newDocument -Type RoyalFolder -Name "DMZ-NET"

 $events = New-RoyalObject -folder $newDocument -Type RoyalWindowsEventsConnection -Name "Windows Events"

 Set-RoyalObjectValue -Object $events -Property "URI" -Value ""


To get a list of all available types, browse the -Type parameter with pressing TAB multiple times.


More Information

In a PowerShell session, you can get information to all commandlets by using the Get-Help command.