ITJef
Enthusiast
Enthusiast

Entitle User to a machine in Horizon.

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.

pastedImage_0.png

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

       

0 Kudos
4 Replies
LucD
Leadership
Leadership

Did you make sure that the pool is of type Automated?

With a Manual pool it won't do the user assignment.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
ITJef
Enthusiast
Enthusiast

yeah i just enabled automatic assignment and tried again and i get the same behavior. no error messages....it adds the machine but the user is not added. I have tried all the different combinations of the username (samaccountname, DOMAIN\Samaccountname, Samaccountname@domain.com) and nothing works but i get no errors. Thats the issue  i have nothing to go on.

pastedImage_0.png

0 Kudos
ITJef
Enthusiast
Enthusiast

Is this going to be possible in 7.3.1?

0 Kudos
Magneet
Hot Shot
Hot Shot

Oops did something wrong with my other account, wanted to reply only the first message from that one excuses for that! but this was my reply:

it is possible and I blogged about it last week:

https://www.retouw.nl/powercli/adding-manual-desktops-in-horizon-view-and-assigning-them-using-power...

powercli 6.5 or higher and the vmware.hv.helper module is required

feel free to ask any more questions Smiley Happy

0 Kudos