fborges555
Enthusiast
Enthusiast

VDI pool name and user list

Jump to solution

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?

0 Kudos
2 Solutions

Accepted Solutions
LucD
Leadership
Leadership

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

0 Kudos
LucD
Leadership
Leadership

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

0 Kudos
3 Replies
LucD
Leadership
Leadership

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

0 Kudos
fborges555
Enthusiast
Enthusiast

L.

 

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

 

Thanks Chief

 

0 Kudos
LucD
Leadership
Leadership

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

0 Kudos