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 VDI Host servers. $VDIHost = New-VDIHost -Server "vdi.company.dom" -VDIType VmwareESXi6_0 -VDIUsername root -VDIAgentOStype Appliance -VDIAgent "vdiagent.company.do" -Username root
#Apply settings, for the Publishing Agent to connect with the new VDI Host. Invoke-Apply
#Get the list of Virtual Machines through the RAS VDI Host Agent Get-VM -VDIHostId $VDIHost.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-VDITemplate -VDIHostId $VDIHost.Id -VMId 564d5e6f-3fad-bcf9-7c6b-bac9f212713d -TemplateName WinRDStemplate -GuestNamePrefix WinRDS- -MaxGuests 5 -PreCreatedGuests 2 -GuestsToCreate 1 -ImagePrepTool RASPrep -OwnerName Owner -Organization Parallels -JoinDomain 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-Apply
###### RDSGROUP CONFIGURATION ######
#Create an RD Session Host Group and add RDS Template object to it. New-RDSGroup -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-Apply
#End the current RAS session. Remove-RASSession