- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Looking for a script to capture multiple IP address and its subnet mask, Gateway, VLAN information for more than 1000 VMs from vCenter server. I'm not sure how to get Get-VM into loop to obtain multiple IP address, subnet, VLAN, gateway to export to CSV file.
Could you please point me the correct syntax for this. Thanks in advance.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
To get the IP addresses, provided there are multiple in a guest OS, in 1 property, you could do something like this
Get-VM |
Select Name,@{N='IP';E={[string]::Join(',',$_.Guest.IPAddress)}}
To get a separate row per IP address, you could do
foreach($vm in Get-VM){
$vm.Guest.IPAddress |
Select @{N='Name';E={$vm.name}},@{N='IP';E={$_}}
}
Both of these methods require the VMware Tools to be installed and the VM to be powered on
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks LucD and Vineeth.
Vineeth - this is the information I'm looking for. Will run these and see what the output when running on VMs having multiple Nics.