0
votes

I am trying to use a PowerCli commandlet to create a new virtual machine

New-VM -ResourcePool vfcplvmh0009 -Version v11 -Name TestServer22 -Datastore 0031_A_Normal001 -DiskGB 100 -DiskStorageFormat EagerZeroedThick -MemoryGB 4 -NumCpu 2 -CoresPerSocket 2 -Template Win2012-STDR2_GoldenImage -Confirm $false

However it will not run and displays the following error message

New-VM : Parameter set cannot be resolved using the specified named parameters. At line:1 char:1 + New-VM -ResourcePool vfcplvmh0009 -Version v11 -Name TestServer22 -Da ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidArgument: (:) [New-VM], ParameterBindingException + FullyQualifiedErrorId : AmbiguousParameterSet,VMware.VimAutomation.ViCore.Cmdlets.Commands.NewVM

I am unsure as to why this error message is being generated as all the parameters and data for them appear to be correct.

1
New-VM cmdlet parameters have different parametersets. You can not mix parameters from different parametersets. This should help explainjrider
Also, Looks like you have a syntax error. -Confirm:$falsePeter Kay

1 Answers

1
votes

Looks like you have a syntax error.

-Confirm:$false

This is a common mistake when using the -Confirm parameter.

Also, you cannot use the template parameter because it is a part of a different parameter set.

If you remove the -Template parameter, then you should be able to create the VM.

In VMWare, the template will already have the CPU, RAM, and HDisk information to describe the vmdk file. You have to use one or the either. Can't use both.