> For the complete documentation index, see [llms.txt](https://docs.parallels.com/landing/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.parallels.com/landing/ras-powershell-api-guide/v20/examples/publishing.md).

# Publishing Example

## Parallels RAS PowerShell - Publishing Example

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

\###### FARM CONFIGURATION ######

\#Add two RD Session Host servers. $RDS1 =[New-RASRDS](/landing/ras-powershell-api-guide/v20/parallels-ras-powershell-admin-module/index.md#New-RASRDS) -Server\
"rds1.company.dom"\
$RDS2 = [New-RASRDS](/landing/ras-powershell-api-guide/v20/parallels-ras-powershell-admin-module/index.md#New-RASRDS) -Server\
"rds2.company.dom"

\#Get the list of RD Session Host servers. $RDSList =[Get-RASRDS](/landing/ras-powershell-api-guide/v20/parallels-ras-powershell-admin-module/index.md#Get-RASRDS)

\#Create a RAS RD Session Host group and add both RDS objects to it.\
$RDSGrp = [New-RASRDSGroup](/landing/ras-powershell-api-guide/v20/parallels-ras-powershell-admin-module/index.md#New-RASRDSGroup)\
-Name "My RDS Group" -RDSObject $RDSList

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

\###### PUBLISHING CONFIGURATION ######

\#Add published folders to be used by different departments. $Fld\_Acc =[New-RASPubFolder](/landing/ras-powershell-api-guide/v20/parallels-ras-powershell-admin-module/index.md#New-RASPubFolder) -Name\
"AccDept" -Description "Accounting"\
$Fld\_Sales =[New-RASPubFolder](/landing/ras-powershell-api-guide/v20/parallels-ras-powershell-admin-module/index.md#New-RASPubFolder) -Name\
"SalesDept" -Description "Sales"

\#Add published desktops within their respective folders. $Desk\_Acc =[New-RASPubRDSDesktop](/landing/ras-powershell-api-guide/v20/parallels-ras-powershell-admin-module/index.md#New-RASPubRDSDesktop)\
-Name "AccPubDesktop" -ParentFolder $Fld\_Acc -DesktopSize FullScreen\
-PublishFrom Group -PublishFromGroup $RDSGrp\
$Desk\_Sales =[New-RASPubRDSDesktop](/landing/ras-powershell-api-guide/v20/parallels-ras-powershell-admin-module/index.md#New-RASPubRDSDesktop)\
-Name "SalesPubDesktop" -ParentFolder $Fld\_Sales -DesktopSize Custom\
-Width 600 -Height 400 -PublishFrom All

\#Add published applications within their respective folders. $App\_Acc\
\= [New-RASPubRDSApp](/landing/ras-powershell-api-guide/v20/parallels-ras-powershell-admin-module/index.md#New-RASPubRDSApp) -Name\
"AccPubApp" -Target "C:\Windows\System32\calc.exe" -ParentFolder\
$Fld\_Acc -PublishFrom All -WinType Maximized -StartOnLogon\
$App\_Sales =[New-RASPubRDSApp](/landing/ras-powershell-api-guide/v20/parallels-ras-powershell-admin-module/index.md#New-RASPubRDSApp) -Name\
"SalesPubApp" -Target "C:\Windows\System32\notepad.exe" -ParentFolder\
$Fld\_Sales -PublishFrom Server -PublishFromServer $RDS1

\#Update default settings used to configure published resources.\
[Set-RASPubDefaultSettings](/landing/ras-powershell-api-guide/v20/parallels-ras-powershell-admin-module/index.md#Set-RASPubDefaultSettings)\
-CreateShortcutOnDesktop $true

\#Override shortcut default settings for a specific published\
application. [Set-RASPubRDSApp](/landing/ras-powershell-api-guide/v20/parallels-ras-powershell-admin-module/index.md#Set-RASPubRDSApp)\
-InputObject $App\_Sales -InheritShorcutDefaultSettings $false\
-CreateShortcutOnDesktop $false

\###### PUB FILTERING CONFIGURATION ######

\#Set AD account filters by ID.\
[Add-RASRule](/landing/ras-powershell-api-guide/v20/parallels-ras-powershell-admin-module/index.md#Add-RASRule) -Id $Desk\_Acc.Id\
-ObjType PubItem -RuleName "Rule 1"\
$Desk\_Acc\_Rules = [Get-RASRule](/landing/ras-powershell-api-guide/v20/parallels-ras-powershell-admin-module/index.md#Get-RASRule) -Id\
$Desk\_Acc.Id -ObjType PubItem\
[Set-RASCriteria](/landing/ras-powershell-api-guide/v20/parallels-ras-powershell-admin-module/index.md#Set-RASCriteria) -Id\
$Desk\_Acc.Id -ObjType PubItem -SecurityPrincipalsEnabled $true -RuleId\
$Desk\_Acc\_Rules\[0].Id\
[Add-RASCriteriaSecurityPrincipal](/landing/ras-powershell-api-guide/v20/parallels-ras-powershell-admin-module/index.md#Add-RASCriteriaSecurityPrincipal)\
-Id $Desk\_Acc.Id -ObjType PubItem -RuleId $Desk\_Acc\_Rules\[0].Id\
-Account "Guests"

\#Set AD account filters by object.\
[Add-RASCriteriaSecurityPrincipal](/landing/ras-powershell-api-guide/v20/parallels-ras-powershell-admin-module/index.md#Add-RASCriteriaSecurityPrincipal)\
-Id $Desk\_Acc.Id -ObjType PubItem -RuleId $Desk\_Acc\_Rules\[0].Id -SID\
"S-1-5-11"

\#Set an IP filter (with range) on application.\
[Add-RASRule](/landing/ras-powershell-api-guide/v20/parallels-ras-powershell-admin-module/index.md#Add-RASRule) -InputObject $App\_Acc\
-RuleName "Rule 1"\
$App\_Acc\_Rules = [Get-RASRule](/landing/ras-powershell-api-guide/v20/parallels-ras-powershell-admin-module/index.md#Get-RASRule) -Id\
$App\_Acc.Id -ObjType PubItem\
[Set-RASCriteria](/landing/ras-powershell-api-guide/v20/parallels-ras-powershell-admin-module/index.md#Set-RASCriteria) -InputObject\
$App\_Acc -RuleId $App\_Acc\_Rules\[0].Id -IPsEnabled $true\
[Add-RASCriteriaIP](/landing/ras-powershell-api-guide/v20/parallels-ras-powershell-admin-module/index.md#Add-RASCriteriaIP)\
-InputObject $App\_Acc -RuleId $App\_Acc\_Rules\[0].Id -IPType Version4\
-IP "10.0.0.1-10.0.0.12"

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

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

© 2025 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.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.parallels.com/landing/ras-powershell-api-guide/v20/examples/publishing.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
