Parallels RAS PowerShell - Publishing Example

#Establish a connection with Parallels RAS (Replace Administrator with your RAS root account). New-RASSession Administrator ###### FARM CONFIGURATION ###### #Add two RD Session Host servers. $RDS1 = New-RDS -Server "rds1.company.dom" $RDS2 = New-RDS -Server "rds2.company.dom" #Get the list of RD Session Host servers. $RDSList = Get-RDS #Create a RAS RD Session Host group and add both RDS objects to it. $RDSGrp = New-RDSGroup -Name "My RDS Group" -RDSObject $RDSList #Update default settings used to configure RD Session Host agents. Set-RDSDefaultSettings -MaxSessions 100 -EnableAppMonitoring $true ###### PUBLISHING CONFIGURATION ###### #Add published folders to be used by different departments. $Fld_Acc = New-PubFolder -Name "AccDept" -Description "Accounting" $Fld_Sales = New-PubFolder -Name "SalesDept" -Description "Sales" #Add published desktops within their respective folders. $Desk_Acc = New-PubRDSDesktop -Name "AccPubDesktop" -ParentFolder $Fld_Acc -DesktopSize FullScreen -PublishFrom Group -PublishFromGroup $RDSGrp $Desk_Sales = New-PubRDSDesktop -Name "SalesPubDesktop" -ParentFolder $Fld_Sales -DesktopSize Custom -Width 600 -Height 400 -PublishFrom All #Add published applications within their respective folders. $App_Acc = New-PubRDSApp -Name "AccPubApp" -Target "C:\Windows\System32\calc.exe" -ParentFolder $Fld_Acc -PublishFrom All -WinType Maximized -StartOnLogon $App_Sales = New-PubRDSApp -Name "SalesPubApp" -Target "C:\Windows\System32\notepad.exe" -ParentFolder $Fld_Sales -PublishFrom Server -PublishFromServer $RDS1 #Update default settings used to configure published resources. Set-PubDefaultSettings -CreateShortcutOnDesktop $true #Override shortcut default settings for a specific published application. Set-PubRDSApp -InputObject $App_Sales -InheritShorcutDefaultSettings $false -CreateShortcutOnDesktop $false ###### PUB FILTERING CONFIGURATION ###### #Set AD account filters by ID. Set-PubItemUserFilter -Id $Desk_Acc.Id -Enable $true Add-PubItemUserFilter -Id $Desk_Acc.Id -Account "Accounts" #Set AD account filters by object. Set-PubItemUserFilter -InputObject $Desk_Sales -Enable $true -Replicate $true Add-PubItemUserFilter -InputObject $Desk_Sales -Account "Sales" #Set an IP filter (with range) on application. Set-PubItemIPFilter -InputObject $App_Acc -Enable $true Add-PubItemIPFilter -InputObject $App_Acc -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-Apply #End the current RAS session. Remove-RASSession