<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: command to retrieve visible networks for each vmnic in VMware PowerCLI Discussions</title>
    <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/command-to-retrieve-visible-networks-for-each-vmnic/m-p/2919830#M107522</link>
    <description>&lt;P&gt;how can this exported to sv&lt;/P&gt;</description>
    <pubDate>Thu, 21 Jul 2022 19:24:14 GMT</pubDate>
    <dc:creator>basszzz</dc:creator>
    <dc:date>2022-07-21T19:24:14Z</dc:date>
    <item>
      <title>command to retrieve visible networks for each vmnic</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/command-to-retrieve-visible-networks-for-each-vmnic/m-p/710987#M19234</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello all,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We have on fairly regular basis "discussions" with our it comms brethren about the configuration of their switches / trunks etc when we have communications issues with VMs. More often than not, in our environment anyway, it turns out to be a misconfigured switch ports or trunks. So I am wondering if it is possible to report on the trunked networks that a pnic on an ESX server can see using PowerShell / VI Perl Toolkit.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To explain what I mean, In the VI Client I can click on a host -&amp;gt; configuration tab -&amp;gt; select network adapters. In the right hand pane it displays all the pnics in the host, to the right is the Networks column and this displays the networks that this pnic has visibility of, e.g. all the vlans that are trunked to it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can I get this information from one of the toolkits? Preference, well not my preference but the company i work for, is PowerShell.&lt;/P&gt;&lt;P&gt;I have had a look at the change log for VI Toolkit for windows 1.5 as well.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What I would like to be able to do is run a report across the cluster(s) to ensure all the pnics that are connected to the VM vSwitches can all see the same networks. In the same way you can do with the datastores / luns / port groups.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 Feb 2009 03:54:59 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/command-to-retrieve-visible-networks-for-each-vmnic/m-p/710987#M19234</guid>
      <dc:creator>Herschelle</dc:creator>
      <dc:date>2009-02-06T03:54:59Z</dc:date>
    </item>
    <item>
      <title>Re: command to retrieve visible networks for each vmnic</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/command-to-retrieve-visible-networks-for-each-vmnic/m-p/710988#M19235</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Based on &lt;SPAN __jive_macro_name="message" id="1150238"&gt;&lt;/SPAN&gt; the script below emulates the  page from the VI client.&lt;/P&gt;&lt;PRE __jive_macro_name="noformat"&gt;
Write-Host "Device" "`t" "Speed" "`t`t" "Configured" "`t" "vSwitch" "`t" "Observed IP ranges" "`t`t" "WOL"

Get-VMHost | Sort-Object -property Name | Get-View | % {
	Write-Host "ESX : " $_.Name

	foreach($pnic in $_.Config.Network.Pnic){
		$device = $pnic.Device
		$speed = [string]($pnic.LinkSpeed.SpeedMb)
		if($pnic.LinkSpeed.Duplex){$speed += " Full"}
		foreach($vs in $_.Config.Network.Vswitch){
			foreach($pn in $vs.Pnic){
				if($pn -eq $pnic.Key){$vswitch = $vs.Name}
			}
		}
        $configured = ""
		if($pnic.Spec.LinkSpeed -eq $null){
		  $configured = "Negotiate"
		} 
		$netSys = Get-View $_.ConfigManager.NetworkSystem
		$IPrange = ""
		$hintinfo = $netSys.QueryNetworkHint($pnic.Device)
		foreach($pnicHintInfo in $hintinfo){
			foreach($pnicIPHint in $pnicHintInfo.subnet){
				$IPrange += $pnicIPHint.IpSubnet
				if($pnicIPHint.VlanId -ne 0){
				  $IPrange += (" (VLAN " + $pnicIPHint.VlanId + ")")
				}
				if($pnicHintInfo.Subnet.Count -gt 1){
				  $IPrange += ","
				}
			}
		}
		if($pnic.WakeOnLanSupported) {$WOL = "Yes"} else {$WOL = "No"}

		Write-Host $device "`t" $speed "`t" $configured "`t" $vswitch "`t" $IPrange "`t" $WOL
	}
}
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 Feb 2009 06:53:12 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/command-to-retrieve-visible-networks-for-each-vmnic/m-p/710988#M19235</guid>
      <dc:creator>LucD</dc:creator>
      <dc:date>2009-02-06T06:53:12Z</dc:date>
    </item>
    <item>
      <title>Re: command to retrieve visible networks for each vmnic</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/command-to-retrieve-visible-networks-for-each-vmnic/m-p/710989#M19236</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;thanks, i will give that a go and let you know how it goes.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Feb 2009 01:34:01 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/command-to-retrieve-visible-networks-for-each-vmnic/m-p/710989#M19236</guid>
      <dc:creator>Herschelle</dc:creator>
      <dc:date>2009-02-09T01:34:01Z</dc:date>
    </item>
    <item>
      <title>Re: command to retrieve visible networks for each vmnic</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/command-to-retrieve-visible-networks-for-each-vmnic/m-p/710990#M19237</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thankyou very much LucD, That is what I am looking for. I will do some manipulation of the output but at least now I have the data.  &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.vmware.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Feb 2009 01:54:11 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/command-to-retrieve-visible-networks-for-each-vmnic/m-p/710990#M19237</guid>
      <dc:creator>Herschelle</dc:creator>
      <dc:date>2009-02-09T01:54:11Z</dc:date>
    </item>
    <item>
      <title>Re: command to retrieve visible networks for each vmnic</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/command-to-retrieve-visible-networks-for-each-vmnic/m-p/2919830#M107522</link>
      <description>&lt;P&gt;how can this exported to sv&lt;/P&gt;</description>
      <pubDate>Thu, 21 Jul 2022 19:24:14 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/command-to-retrieve-visible-networks-for-each-vmnic/m-p/2919830#M107522</guid>
      <dc:creator>basszzz</dc:creator>
      <dc:date>2022-07-21T19:24:14Z</dc:date>
    </item>
  </channel>
</rss>

