简体   繁体   English

vmware powercli

[英]vmware powercli

i want to create New vm's from muliple template's like windows 8,7 and more like that, also want to choose how many i need of that vm. 我想从像Windows 8,7之类的多模板创建新的vm,也想选择我需要多少个vm。

the full code is here: link to pastebin 完整的代码在这里: 链接到pastebin

but the thing is i want to do multiple templates at once how can i do that? 但问题是我想一次做多个模板,我该怎么做?

i was thinking about an foreach($template in $template){do that} 我在考虑一个foreach($ template中的$ template){这样做}

then im doing template1,template2 but its giving me the error that its just template1,template2 instead of 2 diffrent templates dont know how to seperate that. 然后我在做template1,template2但它给我的错误是它只是template1,template2而不是2个不同的模板不知道如何分开。 i thought about the , but i dont know then. 我考虑过了,但那时我不知道。

This is not possible, you have to specify one (and only one) template to create a new from template. 这是不可能的,您必须指定一个(并且只有一个)模板才能从模板创建新模板。

You can verify that by running the following command : 您可以通过运行以下命令来验证:

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

As you can see , this -Template parameter takes only one object of the type [Template]. 如您所见,此-Template参数仅接受[Template]类型的一个对象。 If it were able to take several, we would see : 如果能够取几个,我们将看到:

-Template <Template[]>

But it is the same in the GUI anyway : in the vSphere client you have to choose only one template to create a VM from it. 但是无论如何,它在GUI中都是相同的:在vSphere Client中,您只需选择一个模板即可从中创建VM。

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

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