Create and Configure a Logical Network and IP Address Pool (Script)


Updated: May 13, 2016

Applies To: System Center 2012 R2 Virtual Machine Manager, System Center 2012 - Virtual Machine Manager

Logical networks enable network administrators to model the network based on recognizable categories that align to business needs by grouping together subnets and VLANs. After you create a new logical network, use the logical network definition, also called a network site, to assign IP subnets and VLANs to the logical network.

You can create a static IP address pool and associate it with one or more host groups. After you have created a static IP address pool, you can add DNS servers to it by using the Set-SCStaticIPAddressPool cmdlet.

For more information about configuring networking in System Center 2012 – Virtual Machine Manager, see Configuring Networking in VMM.


The following script creates and configures a logical network and a static IP address pool. The script assumes that you have already created a host group named Seattle.

# Description:   This script creates a logical network and then creates a logical   
#                network definition that it applies it to the logical network.  
#                The script then creates a static IP address pool, associates   
#                the pool with a host group, and adds DNS servers.   
# Create a logical network.  
$LogicalNetwork = New-SCLogicalNetwork -Name "FrontEnd"  
# Create a logical network definition and associate it with the new logical network.  
$HostGroup = Get-SCVMHostGroup | where { $_.Path -eq "All Hosts\Seattle" }  
$SubnetVLAN = New-SCSubnetVLAN -Subnet "" -VLAN 25  
$LogNetDef = New-SCLogicalNetworkDefinition -Name "Logical Network Definition for Seattle" -LogicalNetwork $LogicalNetwork -VMHostGroup $HostGroup -SubnetVLAN $SubnetVLAN  
# Create a static IP address pool and associate it with a host group.  
$HostGroup = Get-SCVMHostGroup | where { $_.Path -eq "All Hosts\New York\Production" }  
$DefaultGateway = New-SCDefaultGateway -IPAddress "" -Metric 10  
$IPPool = New-SCStaticIPAddressPool -LogicalNetworkDefinition $LogNetDef -Name "Production IP Address Pool" -Description "This IP address pool is for production use in Seattle." -Subnet "" -IPAddressRangeStart "" -IPAddressRangeEnd "" -IPAddressReservedSet "," -VIPAddressSet "" -DNSSuffix "" -DNSSearchSuffix, -DNSServer "", "" -WINSServer "", "" -DefaultGateway $DefaultGateway -EnableNetBIOS $True  
# Add DNS servers to the static IP address pool.  
$DNSServerIPAddress = $IPPool.DNSServers  
$DNSServerIPAddress += ""  
Set-SCStaticIPAddressPool -StaticIPAddressPool $IPPool -DNSServer $DNSServerIPAddress