Parallels RAS PowerShell - RDS Template Example

#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" -Type VmwareESXi6_0 -VDIUsername root -VDIAgent "vdiagent.company.do" -Username root
#Apply settings, for the Publishing Agent 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 -VDIGuestId 564d5e6f-3fad-bcf9-7c6b-bac9f212713d -Name WinRDStemplate -GuestNamePrefix WinRDS- -MaxGuests 5 -PreCreatedGuests 2 -GuestsToCreate 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