You can deploy multiple virtual machines with a single network adapter and configure the deployed virtual machines to use static IP addresses by applying a customization specification.

Verify that you have defined a list of static IP addresses in a CSV file.


Define the naming convention for the virtual machines.

$vmNameTemplate = "VM-{0:D3}"

Save the cluster in which the virtual machines should be created into a variable.

$cluster = Get-Cluster MyCluster

Save the template on which the virtual machines should be based into a variable.

$template = Get-Template MyTemplate

Create the virtual machines.

$vmList = @()
for ($i = 1; $i –le 100; $i++) {
    $vmName = $vmNameTemplate –f $i
    $vmList += New-VMName $vmName –ResourcePool $cluster –Template $template

Save the static IP addresses from the stored CSV file into a variable.

$staticIpList = Import-CSV C:\StaticIPs.csv

Create the customization specification.

$linuxSpec = New-OSCustomizationSpecName LinuxCustomization –Domain –DnsServer "", "" –NamingScheme VM –OSType Linux

Clone the customization specification to a nonpersistent type.

$specClone = New-OSCustomizationSpecSpec $linuxSpec –Type NonPersistent

Apply the customization specification to each virtual machine.

for ($i = 0; $i –lt $vmList.Count; $i++) {
    # Acquire a new static IP from the list
    $ip = $staticIpList[$i].IP

    # The specification has a default NIC mapping – retrieve it and update it with the static IP
    $nicMapping = Get-OSCustomizationNicMappingOSCustomizationSpec $specClone
    $nicMapping | Set-OSCustomizationNicMappingIpMode UseStaticIP –IpAddress $ip –SubnetMask "" –DefaultGateway ""

    # Apply the customization
    Set-VMVM $vmList[$i] –OSCustomizationSpec $specClone –Confirm:$false