peterxmansson
Contributor
Contributor

PowerCLI User Assignment

Hello.

Since I upgraded to Horizon 8 I can't seem to be able to list all user assignments from my VDIs.
Get-HVMachinesummare only shows active sessions, not the users that are assigned to the machines.

In horizon 7 I used the "C:\Program Files\VMware\VMware View\Server\bin\PowershellServiceCmdlets.dll" and the command Get-DesktopVM to get this information but this broken is not available in Horizon 8.

I have also tried this way:
Get-HVMachineSummary not showing User info - VMware Technology Network VMTN
But it shows the same info as Get-HVMachinesummary, only active sessions.

Any ideas?

Thanks.

0 Kudos
6 Replies
peterxmansson
Contributor
Contributor

Is it because I have manual assignments on the pool I'm querying?

0 Kudos
GarTomlon
Enthusiast
Enthusiast

Only being devil's advocate here, but the pool is dedicated and not floating correct?

0 Kudos
peterxmansson
Contributor
Contributor

Dedicated yes.

RetouwNL
Contributor
Contributor

The rest api has the assigned user_ids, remember that you now can assign multiple users to a machine

VMware Horizon Server API - VMware API Explorer - VMware {code}

with those id you can get the users themselves using 

VMware Horizon Server API - VMware API Explorer - VMware {code}

 

if you want to assign users you can use this script I blogged about: Powercli script to assign a dedicated Horizon machine to multiple users – Retouw.nl

Previously known as Magneet or Magneet_NL
0 Kudos
peterxmansson
Contributor
Contributor

Thanks, the restapi seems to be able to extract assigned users, but I ran into another issue.

If I use the HV.helper powershell module the property BasicState is different than what I get from the restapis machine state.

Restapi:
"https://servername/rest/inventory/v1/machines/$($Machine.ID)" 
This shows almost all VDIs with the State "UNASSIGNED_USER_CONNECTED"

PSModule:
($HVMachineSummary | where {$_.base.name -eq "VMNAME"}).Base.BasicState
But if I use the powershell module it shows as "Connected"

 

any ideas?

0 Kudos
RetouwNL
Contributor
Contributor

that's probably someone in the module assuming something and fixing the wrong thing. I would believe rest a million times over that module.

Previously known as Magneet or Magneet_NL
0 Kudos