# VDI Example

## Parallels RAS PowerShell - VDI Example

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

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

\#Add a Provider. $Provider = [New-RASProvider](https://docs.parallels.com/landing/ras-powershell-api-guide/parallels-ras-powershell-admin-module/index#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](https://docs.parallels.com/landing/ras-powershell-api-guide/parallels-ras-powershell-admin-module/index#Invoke-RASApply)

\#Get the list of Virtual Machines through the RAS Provider Agent [Get-RASVM](https://docs.parallels.com/landing/ras-powershell-api-guide/parallels-ras-powershell-admin-module/index#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](https://docs.parallels.com/landing/ras-powershell-api-guide/parallels-ras-powershell-admin-module/index#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](https://docs.parallels.com/landing/ras-powershell-api-guide/parallels-ras-powershell-admin-module/index#New-RASVDIPool) -Name "VDIPool"

\#Add a VDI Pool Member [Add-RASVDIPoolMember](https://docs.parallels.com/landing/ras-powershell-api-guide/parallels-ras-powershell-admin-module/index#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](https://docs.parallels.com/landing/ras-powershell-api-guide/parallels-ras-powershell-admin-module/index#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](https://docs.parallels.com/landing/ras-powershell-api-guide/parallels-ras-powershell-admin-module/index#Invoke-RASApply)

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

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