# Farm Example

## Parallels RAS PowerShell - Farm Example

\#Establish a connection with Parallels RAS (Replace Administrator with your RAS root account).\
[New-RASSession](https://docs.parallels.com/landing/ras-powershell-api-guide/parallels-ras-powershell-admin-module/index#New-RASSession) Administrator

\#Add a RAS Secure Gateway (replace 'gw\.company.dom' with a valid FQDN, computer name, or IP address).\
[New-RASGateway](https://docs.parallels.com/landing/ras-powershell-api-guide/parallels-ras-powershell-admin-module/index#New-RASGateway) -Server "gw\.company.dom"

\#Add the first RD Session Host server (replace rds1.company.dom with a valid FQDN, computer name, or IP address).\
\#The $RDS1 variable receives an object of type RDS identifying the RD Session Host. $RDS1 = [New-RASRDS](https://docs.parallels.com/landing/ras-powershell-api-guide/parallels-ras-powershell-admin-module/index#New-RASRDS) -Server "rds1.company.dom"

\#Update the description of RD Session Host specified by the $RDS1 variable. [Set-RASRDS](https://docs.parallels.com/landing/ras-powershell-api-guide/parallels-ras-powershell-admin-module/index#Set-RASRDS) -InputObject $RDS1 -Description "Updating RDS Host 1"

\#Add the second RD Session Host. $RDS2 = [New-RASRDS](https://docs.parallels.com/landing/ras-powershell-api-guide/parallels-ras-powershell-admin-module/index#New-RASRDS) -Server "rds2.company.dom"

\#Get the list of RD Session Host servers. The $RDSList variable receives an array of objects of type RDS. $RDSList = [Get-RASRDS](https://docs.parallels.com/landing/ras-powershell-api-guide/parallels-ras-powershell-admin-module/index#Get-RASRDS)

\#Create an RD Session Host Group and add both RD Session Host objects to it. [New-RASRDSGroup](https://docs.parallels.com/landing/ras-powershell-api-guide/parallels-ras-powershell-admin-module/index#New-RASRDSGroup) -Name "My RDS Group" -RDSObject $RDSList

\#Add the third RD Session Host server. $RDS3 = [New-RASRDS](https://docs.parallels.com/landing/ras-powershell-api-guide/parallels-ras-powershell-admin-module/index#New-RASRDS) -Server "rds3.company.dom"

\#Move RDS to RDS Group Member [Move-RASRDSGroupMember](https://docs.parallels.com/landing/ras-powershell-api-guide/parallels-ras-powershell-admin-module/index#Move-RASRDSGroupMember) -GroupName "My RDS Group" -RDSServer "rds3.company.dom"

\#Update default settings used to configure RD Session Host agents.\
[Set-RASRDSDefaultSettings](https://docs.parallels.com/landing/ras-powershell-api-guide/parallels-ras-powershell-admin-module/index#Set-RASRDSDefaultSettings) -MaxSessions 100 -EnableAppMonitoring $true

\#Add a published desktop.\
[New-RASPubRDSDesktop](https://docs.parallels.com/landing/ras-powershell-api-guide/parallels-ras-powershell-admin-module/index#New-RASPubRDSDesktop) -Name "PubDesktop\_1"

\#Activate Parallels RAS as a trial (you will have to provide a valid Parallels My Account email and password).\
[Invoke-RASLicenseActivate](https://docs.parallels.com/landing/ras-powershell-api-guide/parallels-ras-powershell-admin-module/index#Invoke-RASLicenseActivate)

\#Apply all settings. This cmdlet performs the same action as the Apply button in the RAS console.\
[Invoke-RASApply](https://docs.parallels.com/landing/ras-powershell-api-guide/parallels-ras-powershell-admin-module/index#Invoke-RASApply)

\#End the current RAS session.\
[Remove-RASSession](https://docs.parallels.com/landing/ras-powershell-api-guide/parallels-ras-powershell-admin-module/index#Remove-RASSession)

© 2026 Parallels International GmbH. Parallels and the Parallels logo are trademarks or registered trademarks of Parallels International GmbH in Canada, the U.S., and/or elsewhere.
