We was previously using the PSSnapin vmware.view.broker to entitle a user to a machine and it was working great. However when we upgraded to 7.3.1 it seems that snappin is no longer working. I am trying to use the new modules from the github link below and it will add the machine to an existing pool however it wont add the user to the pool for some reason. I dont get an error or anything it just doesn't add the user. Anyone have any advice? The script i currently have does everything except this last step of entitling a user to the VM.
GitHub - vmware/PowerCLI-Example-Scripts
Below is the exact syntax that i am using
add-hvdesktop -PoolName 'ICEWIN10x64ENT-ManualPool' -Machines 'workstation-01' -Users 'MyUsername'
This is the output i receive after running the command above. No error messages so it seems like it works but the user is not entitled to the machine.
Below is the OLD syntax that worked until horizon 7.3.1
add-pssnapin vmware.view.broker | |
Get-Module -ListAvailable VMware* | Import-Module
connect-hvserver $viewserver -Credential $credential
#add machine to pool
add-hvdesktop -pool $vmviewpool -machines $vmname
#add user to VM In pool
$userresult = get-user -name $vmuser
$usersid = $userresult.sid
$vmresult = get-desktopvm -name $vmname
$vmMachineID = $vmresult.Machine_id
update-userownership -machine_id $vmMachineID -sid $usersid
disconnect-hvserver $viewserver -confirm:$false