SHARE
TWEET

Untitled

a guest Jun 19th, 2019 48 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $virtualmachines = Get-VM
  2.  
  3. $vmvlans = Get-VMNetworkAdapterVlan -VM $virtualmachines
  4. $vmnetworkinfo = @()
  5.  
  6. foreach ($virtualmachine in $virtualmachines)
  7. {
  8.  
  9.  
  10.                 $virtualnetworkadapters = Get-VMNetworkAdapter -VM $virtualmachine
  11.                 $vmproperties = New-Object -TypeName PSObject
  12.                 $vmproperties | Add-Member -MemberType NoteProperty -Name VMName -Value $virtualnetworkadapters.vmname
  13.                 $vmproperties | Add-Member -MemberType NoteProperty -Name Name -value  $virtualnetworkadapters.Name
  14.                 $vmproperties | Add-Member -MemberType NoteProperty -Name SwitchName -Value $virtualnetworkadapters.switchname
  15.                 $vmproperties | Add-Member -MemberType NoteProperty -Name isLegacy -Value $virtualnetworkadapters.islegacy
  16.                 $vmproperties | Add-Member -MemberType NoteProperty -name Vlans -value $vmvlans.vlanlist
  17.                 $vmnetworkinfo += $vmproperties
  18.  
  19. }
  20.  
  21. $vmnetworkinfo | ft VMname,Name,SwitchName,isLegacy,Vlanlist
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top