我想创建新的虚拟机从多个模板的windows 8,7和更多的那样,也想选择我需要的虚拟机的数量。
完整的代码在这里:link to pastebin
但问题是我想一次做多个模板,我该怎么做呢?
我在想一个foreach($template中的$template){这么做}
然后我做了template1,template2,但它给我的错误是它只是template1,template2而不是2个不同的模板不知道如何分离它。我想过,但我当时不知道。
发布于 2015-03-11 22:24:27
这是不可能的,您必须指定一个(且只能指定一个)模板来创建新的from模板。
您可以通过运行以下命令进行验证:
Get-Help New-VM -Parameter Template
-Template <Template>
Specifies the virtual machine template you want to use for the creation of the new virtual machine. Passing values to this parameter through a pipeline is deprecated and will be disabled in a future release.
Required? true
Position? 2
Default value
Accept pipeline input? true (ByValue)
Accept wildcard characters? true如您所见,此-Template参数只接受一个模板类型的对象。如果它能够接受多个参数,我们将看到:
-Template <Template[]>但在图形用户界面中是一样的:在vSphere客户端中,您只需选择一个模板即可从该模板创建VM。
https://stackoverflow.com/questions/28942506
复制相似问题