You can use the Update-UserOwnership and Remove-UserOwnership cmdlets to update ownership for virtual machines.
In this example, the Update-UserOwnership cmdlet updates the ownership of a virtual machine named vm04 for a user named user1.
Update-UserOwnership -machine_id (Get-DesktopVM -Name "vm04").machine_id -sid (Get-User -name usr1).sid
In this example, the Remove-UserOwnership cmdlet removes the ownership of a virtual machine named vm22.
Remove-UserOwnership -machine_id (Get-DesktopVM -Name "vm22").machine_id