Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@janegilring
Created January 3, 2015 15:20
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save janegilring/91f174491e498e170981 to your computer and use it in GitHub Desktop.
Save janegilring/91f174491e498e170981 to your computer and use it in GitHub Desktop.
# Import the module
$RTSPSModule = Join-Path -Path ${env:ProgramFiles(x86)} -ChildPath 'code4ward.net\Royal TS V3\RoyalDocument.PowerShell.dll'
Import-Module $RTSPSModule
# Explore available cmdlets
Get-Command -Module RoyalDocument.PowerShell
# Create a new RoyalStore in memory
$Store = New-RoyalStore -UserName ($env:USERDOMAIN + '\' + $env:USERNAME)
# Create the new document
$RoyalDocumentPath = Join-Path -Path $env:USERPROFILE -ChildPath ('Documents\' + $env:USERDOMAIN + '.rtsz')
$RoyalDocument = New-RoyalDocument -Name $env:USERDOMAIN -FileName $RoyalDocumentPath -Store $Store
# Store the new document on disk and close it
Out-RoyalDocument -Document $RoyalDocument
Close-RoyalDocument -Document $RoyalDocument
# Open the document
$RoyalDocument = Open-RoyalDocument -FileName $RoyalDocumentPath -Store $store
# Create a new folder for storing our demo server connection object
$Folder = New-RoyalObject -folder $RoyalDocument -Type RoyalFolder -Name 'PowerShell Magazine'
# Create a new RDS Connection
$RDS = New-RoyalObject -Folder $Folder -Type RoyalRDSConnection -Name PSMag-SRV01 -Description "Demo server"
# Configure the connection URI (hostname)
Set-RoyalObjectValue -Object $RDS -Property URI -Value PSMag-SRV01.demo.local
# Store the updated document on disk and close it
Out-RoyalDocument -Document $RoyalDocument
Close-RoyalDocument -Document $RoyalDocument
# Open the application to verify the changes
$RTSApp = Join-Path -Path ${env:ProgramFiles(x86)} -ChildPath 'code4ward.net\Royal TS V3\RTS3App.exe'
Start-Process -FilePath $RTSApp
# Open the document
$RoyalDocument = Open-RoyalDocument -FileName $RoyalDocumentPath -Store $store
# Store the Remote Desktop connection we want to modify in a variable
$RoyalObject = Get-RoyalObjects -Store $store -Name PSMag-SRV01
# Change the properties we want to modify
$RoyalObject.Smartsizing = $true
$RoyalObject.CredentialFromParent = $true
# Store the updated document on disk and close it
Out-RoyalDocument -Document $RoyalDocument
Close-RoyalDocument -Document $RoyalDocument
# Open the application to verify the changes
$RTSApp = Join-Path -Path ${env:ProgramFiles(x86)} -ChildPath 'code4ward.net\Royal TS V3\RTS3App.exe'
Start-Process -FilePath $RTSApp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment