Automation

 View Only
  • 1.  Entitle User to a machine in Horizon.

    Posted Jan 10, 2018 03:36 PM

    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

           



  • 2.  RE: Entitle User to a machine in Horizon.

    Posted Jan 10, 2018 04:50 PM

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

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



  • 3.  RE: Entitle User to a machine in Horizon.

    Posted Jan 10, 2018 05:19 PM

    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.



  • 4.  RE: Entitle User to a machine in Horizon.

    Posted Jan 15, 2018 04:02 PM

    Is this going to be possible in 7.3.1?



  • 5.  RE: Entitle User to a machine in Horizon.

    Posted Jan 17, 2018 02:12 PM

    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-powercli/

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

    feel free to ask any more questions :smileyhappy: