繁体   English   中英

vmware powercli

[英]vmware powercli

我想从像Windows 8,7之类的多模板创建新的vm,也想选择我需要多少个vm。

完整的代码在这里: 链接到pastebin

但问题是我想一次做多个模板,我该怎么做?

我在考虑一个foreach($ template中的$ template){这样做}

然后我在做template1,template2但它给我的错误是它只是template1,template2而不是2个不同的模板不知道如何分开。 我考虑过了,但那时我不知道。

这是不可能的,您必须指定一个(并且只有一个)模板才能从模板创建新模板。

您可以通过运行以下命令来验证:

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 <Template[]>

但是无论如何,它在GUI中都是相同的:在vSphere Client中,您只需选择一个模板即可从中创建VM。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM