Hi,
I am new to the VMWARE VI Toolkit and I have few questions:
1. I am trying to deploy a VM from template and I am trying to run the following command:
New-VM -VMHost -Template vm2003 -RunAsync
I get the following error:
New-VM : 12/9/2008 11:39:21 AM New-VM The specified parameter 'ResourcePool' expects a single value, but your name criteria 'Res Pol' corresponds to multiple values.
My Resource Pool has space in it.
Note that my Folder Name has space as well but it is working.
2. How can I run for loop (or other loops) from the toolkit window?
Thank you,
Yaniv
1) You can have blanks in resource pool names.
How many objects are returned when you do
Get-ResourcePool "Res Pol"
Do you have resource pools with the same name in different clusters ?
2) You can use the the for
for ($i=0; $i -lt 10; $i++){ <your commands> }
or the foreach loop
$collection = (1,2,3,4,5) foreach ($element in $collection){ <your commands> }
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Hi,
Yes, I have the same name for Resource Pools on different clusters?
Should I use its ID instead?
No, you can't use the Id for the -ResourcePool parameter.
But you can "pipe" the resourcepoolname to the New-VM cmdlet.
That gives you the option to select the resourcepool you want.
Something like this for example
Get-Cluster <cluster-name> | ` Get-ResourcePool <resourcepool-name> | ` New-VM -VMHost <ESX_HOSTNAME> -NAME <VM_NAME> -Location "Folder Name" -Datastore <LUNxx> -Template vm2003 -RunAsync
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference