I'm not a VMware specialist but I manage a large SQL Server estate that is hosted on VMs. I'm familiar with Powershell. As part of my reporting, I want to generate information such as Cluster, Host, VMs, LUN connection, etc. I can't connect or do anything so far so this is literally step 1. Could someone help me get off the ground with this? For starters, a simple list of Hosts and VMs would be great.
First you will need to connect to the vCenter with the Connect-VIServer cmdlet.
Then the Get-VMHost and/or Get-VM cmdlets will retrieve the info for you.
Something like this
Get-VM |
Select Name,@{N='VMHost';E={$_.VMHost.Name}}
You can also go for a ForEach loop over all ESXi nodes.
Something like this
foreach($esx in Get-VMHost){
Get-VM -Location $esx |
Select Name,@{N='VMHost';E={$esx.Name}}
}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
A little more info about Connect-VIServer
Thank you. I will try it out once I get the names of the VI Centers, etc.