mthiha207au
Contributor
Contributor

host profile and associated hosts via powercli

Jump to solution

Hi All,

How can I query the host profile and associated hosts with it? The closest thing I get is this.

(Get-VMhostProfile hostprofilename).extensiondata.entity

Type                         Value

-----                         ------

HostSystem          host-3026

HostSystem          host-3028

But, I am not getting the hostname and get only host value.

0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership

Try like this

Get-VMHostProfile |

Select Name,

    @{N='VMHost';E={(Get-View -Id $_.ExtensionData.Entity).Name -join '|'}}


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

View solution in original post

0 Kudos
4 Replies
LucD
Leadership
Leadership

Try like this

Get-VMHostProfile |

Select Name,

    @{N='VMHost';E={(Get-View -Id $_.ExtensionData.Entity).Name -join '|'}}


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

View solution in original post

0 Kudos
mthiha207au
Contributor
Contributor

Thank you Master.LucD

Get-View . This is it.

0 Kudos
LucD
Leadership
Leadership

Yup, the moment you see a MoRef, you can get the object it is pointing to with the Get-View cmdlet.


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

0 Kudos
DavidGriswoldeB
Contributor
Contributor

Sorry about necroing a 3 year old thread, but is there a reference back to Auto Deploy rules? We do not apply Host Profiles directly to clusters or ESXi hosts, so there is not a MoRef to those objects. 

I know I can just run Get-DeployRuleSet to see which Host Profiles are referenced to which rules, but looking for a one-liner that will do both for me, if possible.

0 Kudos