This script/Powershell functions can be used for (automatic) provisioning VM networks based on VLANs on existing Logical Network and switches in Virtual Machine Manager.
Create VM Network Function:
1. Check if VLAN already exist
2. Create Network site in logical network and add VLAN
3. Enable VLAN on Uplink Port Profile
4. Create VM Network
Remove VM Network Function:
1. Remove Logical Network Definition from Uplink Port Profile
2. Remove VM Network
3. Remove Logical Network Definition from Logical Network
<# .Synopsis Provisioning VM Networks .DESCRIPTION Add and Remove VM Networks on VLAN-based Logical Networks .EXAMPLE CreateVLAN -LogicalNetwork = "Tenant Network" -VLANName = "Blue Network" -VLANID "999" -$VLANSubnet "10.10.10.0/24" -Hostgroup = "Amsterdam" RemoveVLAN -LogicalNetwork = "Tenant Network" -VLANName = "Blue Network" .NOTES Version 1.0 - Initial Script Written by Darryl van der Peijl Date: 23.05.2014 Check Uplink Port Profile name on line 40 Use at own risk #>
Function CreateVMNetwork {
param($LogicalNetwork,$NetworkName,$VLANID,$VLANSubnet,$Hostgroup)
Function CreateVMNetwork {
param($LogicalNetwork,$NetworkName,$VLANID,$VLANSubnet,$Hostgroup)
Download the script here