Advertisement
pedronrivera

Get VMHost PortGroups

Aug 14th, 2019
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #Get VMHost Port Groups
  2. #Connect-VIServer -Server "drvcenterapp01p.corp.pediatrix.net" -User "mednax.local\PowerCLIReadOnly" -Password "5Ulq4osct!zb70"
  3.  
  4. Get-VMHost | foreach {
  5.  
  6.     $vhost = $_
  7.     $portGroup = Get-VirtualPortGroup -VMHost $vhost.Name
  8.     $prop = @{
  9.             'Name' = $vhost.Name
  10.             'VLANName' = $portGroup.Name
  11.             'VLANNum'  = $portGroup.VLANID
  12.  
  13.             }
  14.             new-object -type PSObject -property $prop
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement