When exporting objects of a Royal TS/X file using the UI you can either choose to export
- All Objects (Common Properties) - which really only exports the Name and the Description or
- Specific Objects (like Credentials or Remote Desktop Connections or ...) but only one type at a time
In order to export all objects with the properties that are interesting to you, you can use the following Powershell Script as a starting point:
Import-Module RoyalDocument.PowerShell # concatenate the folder-structure by using "/" as separator function Get-ParentFolderPath($params) { $o = Get-RoyalObject -Folder $params[0] -Id $params[1].ParentId if($null -ne $o) { if($null -ne $o.ParentId) { $( $(Get-ParentFolderPath $params[0], $o) + "/" + $o.Name) } else { $o.Name } } } $fileName = "<path>\export_all_to_csv.rtsz" $csvFileName = "<path>\export_all_to_csv.csv" # Open the RoyalTS document $store = New-RoyalStore -UserName "ScriptUser" $doc = Open-RoyalDocument -Store $store -FileName $fileName #supported Export Types - adapt if needed $exportedObjectTypes = @( "RoyalFolder", "RoyalDynamicFolder", "RoyalCredential", "RoyalDynamicCredential", "RoyalToDo", "RoyalRDSConnection", "RoyalVNCConnection", "RoyalSSHConnection", "RoyalFileTransferConnection", "RoyalWebConnection", "RoyalTeamViewerConnection", "RoyalAppConnection", "RoyalPerformanceConnection", "RoyalPowerShellConnection", "RoyalWindowsEventsConnection", "RoyalWindowsProcessesConnection", "RoyalWindowsServicesConnection", "RoyalTerminalServicesConnection", "RoyalHyperVConnection", "RoyalVMwareConnection", "RoyalManagementEndpoint", "RoyalSecureGateway", "RoyalRDSGateway", "RoyalCommandTask", "RoyalKeySequenceTask", "RoyalApplicationSetting" ) $allObjects = @() if ($null -ne $doc) { foreach ($objectType in $exportedObjectTypes) { foreach ($entry in Get-RoyalObject -Folder $doc -Type $objectType) { Write-Host "Working on $($entry)" # iterate over all entries and create an object using the structure # ID|Name|IP|Description|Username|Password|Folderstructure # Note: EffectiveUsername and EffectivePassword are used. # If these are specified in different RoyalDocuments, you first # need to load these documents in the same Store so they # can be resolved. # adapt exported properties to your liking $psEntry = [PSCustomObject]@{ ID = "$($entry.ID)" Name = "$($entry.Name)" Description = "$($entry.Description)" Username = "$($entry.EffectiveUsername)" Password = "$($entry.EffectivePassword)" Folder = Get-ParentFolderPath $doc, $entry } $allObjects += $psEntry } } # export as CSV Write-Host "Exporting $($allObjects.Length) objects" $allObjects | Export-Csv -Path $csvFileName -NoTypeInformation Write-Host "CSV export done" } else { Write-Host "Failed to load the RoyalTS document." }
Note that EffectiveUsernamen and EffectivePassword resolves referenced Credentials. If these are defined in different .rtsz files you need to load them first in the same store so the Credentials can be referenced.