VMware Cloud Community
denjoh44
Enthusiast
Enthusiast
Jump to solution

Template find the esx

With commands powercli, how find the esx of the Template, without change the Template to(in) vm?

thanks you for your help

Reply
0 Kudos
1 Solution

Accepted Solutions
ccalvetTCC
Enthusiast
Enthusiast
Jump to solution

Get-template | select Name,@{Name="Host";Expression={(get-view $_.HostId).Name}}

Blog: http://thecrazyconsultant.com/ | Twitter: @ccalvetTCC

View solution in original post

Reply
0 Kudos
4 Replies
ccalvetTCC
Enthusiast
Enthusiast
Jump to solution

Get-template | select Name,@{Name="Host";Expression={(get-view $_.HostId).Name}}

Blog: http://thecrazyconsultant.com/ | Twitter: @ccalvetTCC
Reply
0 Kudos
TScalzott
Enthusiast
Enthusiast
Jump to solution

How about this?

$Templates = @()

$Hosts = Get-VMHost

foreach ($h in $hosts) {

    $HostTemplates = Get-Template -Location $h

    foreach ($t in $HostTemplates) {

        $TemplateInfo = New-Object PSObject

        $TemplateInfo | Add-Member -MemberType NoteProperty Name -Value $t.Name

        $TemplateInfo | Add-Member -MemberType NoteProperty Host -Value $h.Name

        $Templates += $TemplateInfo

    }

}

$Templates

Reply
0 Kudos
TScalzott
Enthusiast
Enthusiast
Jump to solution

That's certainly much more elegant. I need to learn how to use Get-View!

Reply
0 Kudos
denjoh44
Enthusiast
Enthusiast
Jump to solution

  • Get-template | select Name,@{Name="Host";Expression={(get-view $_.HostId).Name}}

it's ok for me

thank  for your response

Reply
0 Kudos