Skip to content

Instantly share code, notes, and snippets.

@standaloneSA
Created April 28, 2015 12:28

Revisions

  1. standaloneSA revised this gist Apr 28, 2015. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -2,4 +2,6 @@ $MYHOSTNAME = "Your.Host.Here"
    $VMNIC = "vmnic0"

    $NS = (((Get-VMhost -name $MYHOSTNAME) | Get-View).ConfigManager.NetworkSystem)
    (((Get-view -ID $NS).NetworkINfo.Pnic | Where-Object { $_.Device -eq $VMNIC } | %{ (Get-View -ID $NS).QueryNetworkHint($_.Device) }).ConnectedSwitchPort).PortID
    (((Get-view -ID $NS).NetworkINfo.Pnic |
    Where-Object { $_.Device -eq $VMNIC } |
    %{ (Get-View -ID $NS).QueryNetworkHint($_.Device) }).ConnectedSwitchPort).PortID
  2. standaloneSA created this gist Apr 28, 2015.
    5 changes: 5 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,5 @@
    $MYHOSTNAME = "Your.Host.Here"
    $VMNIC = "vmnic0"

    $NS = (((Get-VMhost -name $MYHOSTNAME) | Get-View).ConfigManager.NetworkSystem)
    (((Get-view -ID $NS).NetworkINfo.Pnic | Where-Object { $_.Device -eq $VMNIC } | %{ (Get-View -ID $NS).QueryNetworkHint($_.Device) }).ConnectedSwitchPort).PortID