Hello
I am trying to solve a issue that we have in our environment.
We have massive template sprawl and I am trying to get the full path to every template that we have. There is a very nice function that does this for VM's but nothing is out there for templates and modifying it to accept get-view doesn't work.
I was wondering if any one else has run into this and has a nice way to get the information out with powercli.
Thanks
Which function are you referring to?
You can have a look at my Get-InventoryPlus – Inventory of all vSphere objects, it should also return templates
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Did you try the "Get-Template" cmdlet?
Yes I did, it doesn't have the same behavior has the get-vm and therefore does not return the same values.
Thanks
Which function are you referring to?
You can have a look at my Get-InventoryPlus – Inventory of all vSphere objects, it should also return templates
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thanks this looks very promising
it gets me everything but I was looking for a little more granular. We have over 8000 vm's and templates in each of our vc's, some of them with a lot more and hundreds of hosts.
The only thing that would be nice is if it took a location to run from as a parameter.
You can change line 155
$contView = $viewMgr.CreateContainerView($si.Content.RootFolder,$null,$true)
into
$folder = Get-Folder -Name 'MyFolder'
$contView = $viewMgr.CreateContainerView($folder.ExtensionData.MoRef,$null,$true)
That way the inventory will start in the folder called 'MyFolder' instead of the vSPhere rootfolder
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference