And your sure the template is what you think it is?
Convert it back to a VM and then do a Get-VM to make sure.
Yes, I'm positive. I even tried creating a new template from a VM to eliminate this as a possibility, and I still got the same result.
A few things to check:
- the $template variable contains a single object, and that is indeed the template from which you want to create a VM
- is the template created on the same ESXi node where you are now trying to create the VM?
- Are the requested resources available on that ESXi node
- Anything in the Task & Events for the creation of the VM?
- Did you add the -Verbose switch on the New-VM
- Can you try adding the Datastore parameter on the New-VM, so to direct the new VM to a specific datastore
- Anything in the vpxd log?
- Does the same happen when you create a VM from that template via the Web Client?
Yes, the $template variable only contains a single object, and is the correct template that I am trying to use.
I originally was specifying the cluster instead of an ESXi host for the ResourcePool parameter, but I tried it with the same ESXi host that the template is on, and I had the same result.
The -verbose switch isn't returning anything additional that is helpful.
I was specifying the Datastore parameter for most of the command lines that I tried, and it has plenty of free space.
Creating a VM from the same template was successful in the Web Client, and disks, memory, and vCPUs were provisioned as expected, just as in the thick client.
So, I did find the issue. You had asked what was in Tasks and Events, and my command line had included the -confirm switch, so I was aborting before attempting creation due to the fact that it was telling me it was going to create a VM with the wrong specs. When I ran the command without the -confirm switch, everything worked fine!! The VM was created with the right number of vCPUs, disks with the right capacity, and the right amount of memory. I then re-ran the same command (new VM name) and included the -confirm switch. It again told me it was only going to use a 4GB disk, 256 MB of memory, and 1 vCPU, but it still created a VM as per the template with the right specs. I then switched back to specifying a host cluster instead of an individual host, and again had success. I know for certain that the first several times I tried this yesterday, I did actually have a VM created with only 1 4GB disk, 256 MB of memory, and 1 vCPU. I will have to back track to see which command line change actually created a bad VM, but it definitely seems that the -confirm switch is lying to me.
Thank you for your help today! Having this working is really going to save a ton of time for us going forward.
Yes, this message is certainly confusing. It caused a lot of wasted time the other day while trying to deploy machines. I am certain that one of the machines that I went ahead and deployed did, in fact, have the bad specs reported by the confirmation message, but I'm not sure what the difference was in the command line that accounted for the differing results. Can you point me the in the right direction to report this as a bug?
Thanks again for your help!
You can create a SR.
If the support people claim PowerCLI requires a special Developer Support contract, refer them to PowerCLI Support Breakdown.
For obvious bugs in the cmdlets, not in your scripts, a regular Support Contract is sufficient.
I already reported the issue to the PowerCLI PM, but it won't hurt if more people report it.
I'm actually a Citrix guy, not on the server team, so I don't have access to create an SR. I feel better knowing that you reported it up to the PM, though. I just wanted to make sure that it got on someone's radar.