Hi all,
Apologies if this question has been asked before but haven't been able to find any information on it.
For some reason when I use the Get-Template command within PowerCLI I get no results even though I have templates on the datastore. Using a command such as Get-VM works as expected but for some reason the Get-Template command just won't find anything. Is there anything glaringly obvious that I may have missed out perhaps in the configuration of my virtual environment?
The environment consists of one Datacenter with one ESXi 5.1 host and multiple VMs residing on it. I also have a vCenter virtual appliance to manage the host.
Thanks,
Matt
Hi Matt,
When you run Connect-VIServer, do you connect to ESXi or vCenter server?
I've just tested both:
Maybe this is the case?
Hope this helps,
Steven.
Hi Matt,
You have mentioned that the templates are on the datastore. You need to make sure they are registered to the vCenter server.
I've just tried Get-Template command myself and I was able to retrieve information on all the templates!
-Steven
Hi Steven, thanks for the response.
The template was already registered to the vCenter server but I removed it and re-added it and still no luck seeing it with the Get-Template command.
I've attached a screenshot of the setup to try and show what I mean.
Thanks,
Matt
Does this return your templates ?
Get-View -ViewType VirtualMachine -Filter @{"Summary.Config.Template"="True"} |
Select Name
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Hi LucD,
No, that command doesn't return anything. I'm currently using the evaluation licence for both ESXi and vCenter - would this make a difference in regards to accessing the full API?
Thanks,
Matt
Normally the "free" ESXi license has some limitations, it will only allow you to read, and not write, anything to the vSphere environment from PowerCLI.
But with an evaluation license it should all work.
A stupid test, can you can create a new template, and then check if it is listed.
Something like this
$vm = Get-VM -Name <any-vm>
Set-VM -VM $vm -ToTemplate
Get-Template
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Hi Matt,
When you run Connect-VIServer, do you connect to ESXi or vCenter server?
I've just tested both:
Maybe this is the case?
Hope this helps,
Steven.
Hi guys, thanks for the response.
Turns out that I had been mistakenly been connecting to my ESXi host and not the vCenter server itself. When I connect to the vCenter server everything behaves as expected.
Thanks!