Quantcast
Channel: VMware Communities: Message List
Viewing all articles
Browse latest Browse all 214415

Re: Script to create multiple VM's from template not working for Network adapter variable

$
0
0

You can not use the -Template and -Networkname parameters of the New-VM cmdlet in one command, because both parameters are in different parameter sets. You should create the VM first and then use the Set-NetworkAdapter cmdlet to change the portgroup of the VM. Like in example 4 of the Set-NetworkAdapter cmdlet help:

 

--------------  Example 4 --------------

C:\PS>$myNetworkAdapters = Get-VM | Get-NetworkAdapter -Name "Network adapter 1"
$myVDPortGroup = Get-VDPortgroup -Name MyVDPortGroup
Set-NetworkAdapter -NetworkAdapter $myNetworkAdapters -Portgroup $myVDPortGroup


Retrieves all network adapters named "Network adapter 1" from all virtual machines and connects them to the specified distributed port group.


Viewing all articles
Browse latest Browse all 214415

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>