简体   繁体   中英

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.

the full code is here: link to 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}

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. 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]. 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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