If you are familiar with VMWare, using the GUI, obtaining all the details in large numbers can be painful, however using PowerCLI, you can retrieve this information quickly. If you are connecting to Nodes, then you will have to connect to all the Nodes, else if you have VCenter installed, as long as all your Nodes are managed by VCenter, you will be able to obtain this in a single command. Connect to your VCenter via PowerCLI. If you are not sure how to, refer to Connect via PowerCLI
Connect to your VCenter or Node with the following command:
Connect-VIServer <VCenter or Node Name or IP>
We will break the command down and then combine it to get a specific results. The first part is run: Get-VM
This will list all your VM’s in your VCenter or Node.
Then we want the Network Adaptor information, therefore we will now include Get-NetworkAdapter. We will now run: Get-VM | Get-NetworkAdapter . The Pipe symbol mean I have information and now I am looking for something more specific from the information before the Pipe.
Now we want to get more specific but with only selective information so we will now include a format-list: Get-VM | Get-NetworkAdapter | FL
As mentioned above, we only want specific or selective information which is Parent,MacAddress,NetworkName
Parent = Machine Name
MacAddress = Identifier for the machine
NetworkName = VLAN which that machine resides on. (Only applicable if you have multiple VLAN)
Now for the final command, we will combine:
Get-VM | Get-NetworkAdapter | select Parent,MacAddress,NetworkName
And there you have a nice list of the machines. If you want to export to CSV, just add: export-csv <Filepath.csv> example: Get-VM | Get-NetworkAdapter | select Parent,MacAddress,NetworkName | export-csv c:\VMwareListofMachines.csv