Forked from janegilring/RoyalTS-PSModule-Examples.ps1
Created
November 12, 2015 21:06
-
-
Save lidopaglia/394687f0c3ad5f205ed5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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