Advertisement
jeroenburen

Create-VDS

Oct 12th, 2019
437
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function Create-VDS {
  2.   # Create folder
  3.   $folder = New-Folder -Location Network -Name $($($dvs.Name) + "-DVS")
  4.   # Create VDS
  5.   $vdswitch = New-VDSwitch -Name $folder.Name -NumUplinkPorts 2 -Version 6.0.0 -Location $folder
  6.   # Create Port Groups
  7.   Foreach ($profile in $port_profiles) {
  8.     if (!(($profile.PortProfileName.Split()[-1] -like "*unused*") -or ($profile.PortProfileName.Split()[-1] -like "*uplink*") -or
  9.     ($profile.PortProfileName.Split()[-1] -like "*n1k*"))) {
  10.       Write-Host "Creating Port Group $($profile.PortProfileName.split()[-1]) with VLAN $($profile.VLANs.Split()[-1])"
  11.       New-VDPortgroup -VDSwitch $script:vdswitch -Name $($profile.portprofilename.split()[-1]) -VlanId $($profile.VLANs.Split()[-1]) | Out-Null
  12.     }
  13.   }
  14.   return
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement