Hi!
Help me figure out the problem!
I can't find the correct values for DNS, Gateway, Mask. So that each address corresponds to the correct value DNS, Gateway, Mask.
Script:
Get-Cluster | Get-VM -PipelineVariable vm | Get-NetworkAdapter |
Select @{N='VM';E={$vm.Name}},NetworkName, MacAddress,
@{N=”IP Address”;E={
$nic = $_
$ips = ($vm.Guest.Nics | where{$_.Device.Name -eq $nic.Name}).IPAddress
($ips | where{([ipaddress]$_).AddressFamily -eq 'InterNetwork'}) -join '|'}},
@{N='Gateway';E={($VM.ExtensionData.Guest.IpStack.IpRouteConfig.IpRoute.Gateway.IPaddress | where{$_ -ne $null}) }},
@{N="DNS";E={$vm.ExtensionData.Guest.IpStack.DnsConfig.IpAddress}},
@{N="Subnet Mask";E={$vm.ExtensionData.Guest.Net.IpConfig.IpAddress.PrefixLength}},
@{N='OS';E={$vm.Guest.OSFullName}},
@{N="Attributes";E={[string]::Join('|',($VM.ExtensionData.Value.Value))}} | Out-GridView
What is the problem?
This seems to work for me.
Do you have the VMware Tools installed on those VMs?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
As far as I can see there is no way to split out the DNS information by vNIC.
The only solution I see to ask inside the Guest OS, by for example Invoke-VMScript
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thanks for the help. I tried to make a match by values, but nothing came out. That's why I wrote here. I thought they would help me here.