VMware Cloud Community
BostonTechGuy
Enthusiast
Enthusiast

GET-* CMDLET to Multiple vCenters at once

Before I try this I wanted to run it by the community first.

Doing a simple "Get-Templates" command to pull all the templates for a client.  They have about 20 vCenters.  Can I connect to all 20 at once and run the GET command to all at the same time.  Then export the whole list to CSV?

Thanks,
Boston Tech Guy.

Tags (2)
0 Kudos
2 Replies
LucD
Leadership
Leadership

When you don't specify a Server parameter on the Get cmdlet, it will go out to all connected vCenters, which you can find in $Global:DefaultVIServers.


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

0 Kudos
Wh33ly
Hot Shot
Hot Shot

You should connect to all vCenters first, once you connected to all, you could use the "Get-template" or whatever command to retrieve the information for all connected vCenters

So to come back and answer your question:

Can I connect to all 20 at once and run the GET command to all at the same timeYES

A good example can be found here how to setup your connection to multiple vCenters.

Some PowerCLI 101 – Connecting to Multiple vCenters

Then export the whole list to CSV?

For example if you take the get-template command you could do something like this

Get-Template|Export-Csv -Path D:\TemplateOutput.csv -UseCulture -NoTypeInformation

0 Kudos