VMware Cloud Community
fborges555
Enthusiast
Enthusiast
Jump to solution

VDI pool name and user list

hi gurus

I am trying to get the name of the VM and the users for each machine.-> when I do this:

"get-hvmachinesummary -PoolName "pool" I get the list of machines , user,DNS , state and all

but when I do this:

"get-hvmachinesummary -PoolName "Accenture"| select -ExpandProperty Base | select Name, User"

I get the name of the VM but instead of the user name I get "VMware.Hv.UserOrGroupId"

 

what am I doing wrong?

Reply
0 Kudos
2 Solutions

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

That should be

Get-HVMachineSummary -PoolName "Accenture"| 
Select-Object -Property @{N='Name';E={$_.Base.Name}},
  @{N='User';E={$_.NamesData.UserName}}


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

View solution in original post

Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

You can do a Get-Member, but since this only lists the properties on the 1st level, you have to do the same for nested properties.

$sumary = Get-HVMachineSummary -PoolName "Accenture"
$summary | Get-Member
$summary.Base | Get-Member
$summary.NamesData | Get-Member


A more precise method is to look up the info in the Horizon View API reference.
In this case, you would need to look at the MachineNamesView object.
But to know at which object to look you will need to "read" the code in the VMware.HV.Helper module.


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

View solution in original post

Reply
0 Kudos
3 Replies
LucD
Leadership
Leadership
Jump to solution

That should be

Get-HVMachineSummary -PoolName "Accenture"| 
Select-Object -Property @{N='Name';E={$_.Base.Name}},
  @{N='User';E={$_.NamesData.UserName}}


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

Reply
0 Kudos
fborges555
Enthusiast
Enthusiast
Jump to solution

L.

 

how can I list all the properties, aside from experience? how do you come up with " NamesData.UserName" 

 

Thanks Chief

 

Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

You can do a Get-Member, but since this only lists the properties on the 1st level, you have to do the same for nested properties.

$sumary = Get-HVMachineSummary -PoolName "Accenture"
$summary | Get-Member
$summary.Base | Get-Member
$summary.NamesData | Get-Member


A more precise method is to look up the info in the Horizon View API reference.
In this case, you would need to look at the MachineNamesView object.
But to know at which object to look you will need to "read" the code in the VMware.HV.Helper module.


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

Reply
0 Kudos