Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
#Establish a connection with Parallels RAS (Replace Administrator with your RAS root account).
New-RASSession Administrator
#Add a RAS Secure Gateway (replace 'gw.company.dom' with a valid FQDN, computer name, or IP address).
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 -Server "rds1.company.dom"
#Update the description of RD Session Host specified by the $RDS1 variable.
Set-RASRDS -InputObject $RDS1 -Description "Updating RDS Host 1"
#Add the second RD Session Host. $RDS2 =
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
#Create an RD Session Host Group and add both RD Session Host objects to it.
New-RASRDSGroup -Name "My RDS Group" -RDSObject $RDSList
#Add the third RD Session Host server.
$RDS3 = New-RASRDS -Server "rds3.company.dom"
#Move RDS to RDS Group Member
Move-RASRDSGroupMember -GroupName "My RDS Group" -RDSServer "rds3.company.dom"
#Update default settings used to configure RD Session Host agents.
Set-RASRDSDefaultSettings -MaxSessions 100 -EnableAppMonitoring $true
#Add a published desktop.
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
#Apply all settings. This cmdlet performs the same action as the Apply button in the RAS console.
Invoke-RASApply
#End the current RAS session.
Remove-RASSession
#Establish a connection with Parallels RAS (Replace Administrator with your RAS root account).
New-RASSession Administrator
###### FARM CONFIGURATION ######
#Add a Provider.
$Provider = New-RASProvider -Server "vdi.company.dom" -VMwareESXi -VmwareESXiVersion v6_5 -VDIUsername root -VDIAgent"vdiagent.company.do" -Username root
#Apply settings, for the Publishing Agent to connect with the new Provider.
Invoke-RASApply
#Get the list of Virtual Machines through the RAS Provider Agent
Get-RASVM -ProviderId $Provider.Id
Name State ID Host ID Site ID
---- ----- -- ------- -------
Windows 8 On 564d5e6f-3fad-bcf9-7c6b-bac9f212713d 1 1
#Create a new VDI Template (Guest Automatically Installed)
$vmTemplate = New-RASVDITemplate -Provider $Provider.Id -VMId 564d5e6f-3fad-bcf9-7c6b-bac9f212713d -Name Win10template -VMNameFormat Win10-%ID:3% -MaxVMs 5 -PreCreatedVMs 2 -ImagePrepTool RASPrep -OwnerName Owner -Organization Parallels -Domain company.dom -Administrator Administrator -CloneMethod LinkedClone -TargetOU "OU=VDI,DC=dom,DC=company"
#Add a VDI Pool
$VDIPool = New-RASVDIPool -Name "VDIPool"
#Add a VDI Pool Member
Add-RASVDIPoolMember -VDIPoolId $VDIPool.Id -Type TEMPLATEGUEST -Name $vmTemplate.Name -VDITemplateId $vmTemplate.Id
###### PUBLISHING CONFIGURATION ######
#Add published desktop making use of the VDI Template.
New-RASPubVDIDesktop -Name VDIDesktop -ConnectTo SpecificRASTemplate -VDITemplate $vmTemplate -Persistent $true
#Apply all settings. This cmdlet performs the same action as the Apply button in the RAS console.
Invoke-RASApply
#End the current RAS session.
Remove-RASSession
#Establish a connection with Parallels RAS (Replace Administrator with your RAS root account).
New-RASSession Administrator
###### RDS status info ######
#Adding a RAS RDS
New-RASRDS -Server "rds.company.dom" -Username administrator
#Apply all settings. This cmdlet performs the same action as the Apply button in the RAS console.
Invoke-RASApply
# Get RDS status info
Get-RASRDSStatus -Server rds.company.dom
ID Site ID Server CPU Load Memory Load Agent State
-- ------ ------ ---------- ------------ --------------
1 1 rds.company.dom 8 15 OK
###### Gateway status info #######Adding a RAS Gateway
New-RASGateway -Server "gw.company.dom" -Username administrator
#Apply all settings. This cmdlet performs the same action as the Apply button in the RAS console.
Invoke-RASApply
# Get Gateway status info
Get-RASGatewayStatus -Server gw.company.dom
ID Site ID Server CPU Load Memory Load Agent State
-- ------ ------ ---------- ------------ --------------
1 1 gw.company.dom 13 47 OK
###### Connection Broker status info #######Adding a RAS Connection Broker
New-RASBroker -Server "broker.company.dom" -Username administrator
#Apply all settings. This cmdlet performs the same action as the Apply button in the RAS console.
Invoke-RASApply
# Get Connection Broker status info
Get-RASBrokerStatus -Server broker.company.dom
ID Site ID Server CPU Load Memory Load Agent State
-- ------ ------ ---------- ------------ --------------
1 1 broker.company.dom 2 46 OK
###### Site status info ######
#Adding a RAS Site
New-RASSite -Server "site.company.dom" -Name "MySite" -Username administrator
#Apply all settings. This cmdlet performs the same action as the Apply button in the RAS console.
Invoke-RASApply
# Get Site status info
Get-RASSiteStatus -Server site.company.dom
ID Site ID Server CPU Load Memory Load Agent State
-- ------ ------ ---------- ------------ --------------
1 1 site.company.dom 0 0 OK
###### Provider status info ######
#Add a Provider servers.
$Provider = New-RASProvider -Server "vdi.company.dom" -VMwareESXi -VmwareESXiVersion v6_5 -VDIUsername root -VDIAgent "vdiagent.company.do" -Username root
#Apply all settings. This cmdlet performs the same action as the Apply button in the RAS console.
Invoke-RASApply
# Get Provider status info
Get-RASProviderStatus -Id $Provider.Id
ID Site ID Server CPU Load Memory Load Agent State
-- ------ ------ ---------- ------------ --------------
1 1 vdi.company.dom 18 60 OK
#End the current RAS session.
Remove-RASSession
#Establish a connection with Parallels RAS (Replace Administrator with your RAS root account).
New-RASSession Administrator
###### FARM CONFIGURATION ######
#Activate Parallels RAS with a valid key (you will have to provide a valid Parallels My Account password).
Invoke-RASLicenseActivate -Email "myaccount@email.com" -Key "YOUR-LICENSE-KEY"
#Add the backup Connection Broker server.
New-RASBroker -Server broker.company.dom
#Apply all settings. This cmdlet performs the same action as the Apply button in the RAS console.
Invoke-RASApply
#Get the list of connection Brokers.
Get-RASBroker
ID Site ID Server Enabled Standby Priority
-- ------ ------ ---------- ------------ --------------
1 1 primary.company.dom True False 0
2 1 broker.company.dom True False 1
#End the current RAS session.
Remove-RASSession
###### END FARM CONFIGURATION ######
###### TESTING CONNECTION BROKER PROMOTION ######
#Establish a connection with Parallels RAS (Replace Administrator with your RAS root account).
New-RASSession Administrator -Server "broker.company.dom" -Force
#Get the backup Broker server.
$BackupBroker = Get-RASBroker -Server broker.company.dom
#Promote backup Broker to primary (you will have to provide a valid Parallels My Account password).
Invoke-RASBrokerPromoteToPrimary -Id $BackupBroker.Id -Email "myaccount@email.com"
#After the Broker promotion to Primary the session is logged out, then a new session needs to be created. Establish a connection with Parallels RAS (Replace Administrator with your RAS root account).
New-RASSession Administrator -Server "broker.company.dom" -Force
#Apply all settings. This cmdlet performs the same action as the Apply button in the RAS console.
Invoke-RASApply
#Get the list of Connection Brokers.
Get-RASBroker
ID Site ID Server Enabled Standby Priority
-- ------ ------ ---------- ------------ --------------
1 1 primary.company.dom True False 1
2 1 broker.company.dom True False 0
#End the current RAS session.
Remove-RASSession
#Establish a connection with Parallels RAS (Replace Administrator with your RAS root account).
New-RASSession Administrator
#Adding two RAS RDSs
New-RASRDS -Server "rds1.company.dom" -Username administrator
New-RASRDS -Server "rds2.company.dom" -Username administrator
#Apply all settings. This cmdlet performs the same action as the Apply button in the RAS console.
Invoke-RASApply
# Get all available RAS Agents information
Get-RASAgent
ID Site ID Server Type State Agent Version Server OS
-- ------ ------ ---------- ---------- -------- --------
1 1 broker.company.dom BROKER OK 16.1 (build 1... Microsoft Win...
1 1 rds1.company.dom RDS OK 16.1 (build 1... Microsoft Win...
1 1 gw.company.dom Gateway NotVerified
2 1 rds2.company.dom RDS OK 16.1 (build 1... Microsoft Win...
# Get the RAS Agent information (by server name 'rds1.company.dom')
Get-RASAgent -Server rds1.company.dom | Format-Table
ID Site ID Server Type State Agent Version Server OS
-- ------ ------ ---------- ---------- -------- --------
1 1 rds1.company.dom RDS OK 16.1 (build 1... Microsoft Win...
#Update RDS RAS Agent (by input object)
$rdsAgent = Get-RASAgent -Server rds1.company.dom
Update-RASAgent -InputObject $rdsAgent -Username administrator
#Update RDS RAS Agent (by server name 'rds2.company.dom')
Update-RASAgent -Server rds2.company.dom -Username administrator
# Get all RAS Agents information of type RDS
Get-RASAgent -ServerType RDS | Format-Table
ID Site ID Server Type State Agent Version Server OS
-- ------ ------ ---------- ---------- -------- --------
1 1 rds1.company.dom RDS OK 16.1 (build 1... Microsoft Win...
2 1 rds2.company.dom RDS OK 16.1 (build 1... Microsoft Win...
# Removing RAS Agent (by server name 'rds2.company.dom')
Remove-RASAgent -Server rds2.company.dom -Username administrator
#Apply all settings. This cmdlet performs the same action as the Apply button in the RAS console.
Invoke-RASApply
# Get all available RAS Agents information
Get-RASAgent
ID Site ID Server Type State Agent Version Server OS
-- ------ ------ ---------- ---------- -------- --------
1 1 broker.company.dom BROKER OK 16.1 (build 1... Microsoft Win...
1 1 rds1.company.dom RDS OK 16.1 (build 1... Microsoft Win...
1 1 gw.company.dom Gateway NotVerified
#End the current RAS session.
Remove-RASSession
#Establish a connection with Parallels RAS (Replace Administrator with your RAS root account).
New-RASSession Administrator
###### VDI CONFIGURATION ######
#Add a Provider.
$Provider = New-RASProvider -Server "vdi.company.dom" -VMwareESXi -VmwareESXiVersion v6_5 -VDIUsername root -VDIAgent "vdiagent.company.do" -Username root
#Apply settings for the Connection Broker to connect with the new VDI Host.
Invoke-RASApply
#Get the list of Virtual Machines through the RAS Provider Agent
Get-RASVM -ProviderId $Provider.Id
Name State ID Host ID Site ID
---- ----- -- ------- -------
WinSrv-2012R2 On 564d5e6f-3fad-bcf9-7c6b-bac9f212713d 1 1
#Convert the VM to an RDS Template
$rdsTemplate = New-RASVDITemplate -ProviderId $Provider.Id -VMId 564d5e6f-3fad-bcf9-7c6b-bac9f212713d -Name Win11template -VMNameFormat Win11-%ID:3% -MaxVMs 5 -PreCreatedVMs 2 -VMsToCreate 1 -ImagePrepTool RASPrep -OwnerName Owner -Organization Parallels -Domain company.dom -Administrator Administrator -CloneMethod LinkedClone -TargetOU "OU=VDI,DC=dom,DC=company" -TemplateType RDSH -ComputerName "172.0.15.30"
#Apply settings to finalize RDS Template (and create any clones if required).
Invoke-RASApply
###### RDSGROUP CONFIGURATION ######
#Create an RD Session Host Group and add RDS Template object to it.
New-RASRDSGroup -Name "My RDS Group" -Description "RDSTemplates Group" -UseRASTemplate -RASTemplate $rdsTemplate -WorkLoadThreshold 50 -ServersToAddPerRequest 2 ` -MaxServersFromTemplate 2 -WorkLoadToDrain 20
#Apply all settings. This cmdlet performs the same action as the Apply button in the RAS console. Invoke-RASApply
#End the current RAS session.
Remove-RASSession
#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-RASRDS -Server "rds1.company.dom"
$RDS2 = New-RASRDS -Server "rds2.company.dom"
#Get the list of RD Session Host servers.
$RDSList = Get-RASRDS
#Create a RAS RD Session Host group and add both RDS objects to it.
$RDSGrp = New-RASRDSGroup -Name "My RDS Group" -RDSObject $RDSList
#Update default settings used to configure RD Session Host agents.
Set-RASRDSDefaultSettings -MaxSessions 100 -EnableAppMonitoring $true
###### PUBLISHING CONFIGURATION ######
#Add published folders to be used by different departments.
$Fld_Acc = New-RASPubFolder -Name "AccDept" -Description "Accounting"
$Fld_Sales = New-RASPubFolder -Name "SalesDept" -Description "Sales"
#Add published desktops within their respective folders.
$Desk_Acc = New-RASPubRDSDesktop -Name "AccPubDesktop" -ParentFolder $Fld_Acc -DesktopSize FullScreen -PublishFrom Group -PublishFromGroup $RDSGrp
$Desk_Sales = 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 -Name "AccPubApp" -Target "C:\Windows\System32\calc.exe" -ParentFolder $Fld_Acc -PublishFrom All -WinType Maximized -StartOnLogon
$App_Sales = 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 -CreateShortcutOnDesktop $true
#Override shortcut default settings for a specific published application.
Set-RASPubRDSApp -InputObject $App_Sales -InheritShorcutDefaultSettings $false -CreateShortcutOnDesktop $false
###### PUB FILTERING CONFIGURATION ######
#Set AD account filters by ID.
Add-RASRule -Id $Desk_Acc.Id -ObjType PubItem -RuleName "Rule 1"
$Desk_Acc_Rules = Get-RASRule -Id $Desk_Acc.Id -ObjType PubItem
Set-RASCriteria -Id $Desk_Acc.Id -ObjType PubItem -SecurityPrincipalsEnabled $true -RuleId $Desk_Acc_Rules[0].Id
Add-RASCriteriaSecurityPrincipal -Id $Desk_Acc.Id -ObjType PubItem -RuleId $Desk_Acc_Rules[0].Id -Account "Guests"
#Set AD account filters by object.
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 -InputObject $App_Acc -RuleName "Rule 1"
$App_Acc_Rules = Get-RASRule -Id $App_Acc.Id -ObjType PubItem
Set-RASCriteria -InputObject $App_Acc -RuleId $App_Acc_Rules[0].Id -IPsEnabled $true
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
#End the current RAS session.
Remove-RASSession
#Establish a connection with Parallels RAS (Replace Administrator with your RAS root account).
New-RASSession Administrator
#Add a RAS Secure Gateway (replace 'gw.company.dom' with a valid FQDN, computername, or IP address).
New-RASGateway -Server "gw.company.dom"
#Add an RD Session Host server (replace 'rds.company.dom' with a valid FQDN, computer name, or IP address).
New-RASRDSHost -Server "rds.company.dom"
#Add a published desktop.
New-RASPubRDSDesktop -Name "PubDesktop"
#Activate Parallels RAS as a trial (you will have to provide a valid Parallels My Account email and password).
Invoke-RASLicenseActivate
#Apply all settings. This cmdlet performs the same action as the Apply button in the RAS console.
Invoke-RASApply
#End the current RAS session.
Remove-RASSession