In order to work with the RoyalDocument PowerShell commandlets, you need to register them with your PowerShell session. Just issue the following command and you are good to go:
Import-Module <Path-to-RoyalTS-installation>\RoyalDocument.PowerShell.dll -Force
Usually, Royal TS is installed to C:\Program Files (x86)\code4ward.net\Royal TS V3
If you like to have the RoyalDocment commandlets in all your PowerShell sessions, include this line in your PowerShell profile. To find, where your profile is, call $profile in your PowerShell session.
Usually, this location is at C:\Users\<username>\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1
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
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 "192.168.1.145"
To get a list of all available types, browse the -Type parameter with pressing TAB multiple times.
In a PowerShell session, you can get information to all commandlets by using the Get-Help command.