I have an issue. I am creating a script that will use the New-VM cmdlet as followed: New-VM -Name $_.Name -Template $_.Template -VMHost $_.DestinationHost -Datastore $_.Datastore -OSCustomizationSpec $_.CustomSpec -MemoryGB $_.MemoryGB -NumCpu $_.NumCpu
The issue I am having is when I start typing this command into Powershell it will initially autocomplete the parameters like -Name and -Template. But one I use the -Name parameter and then try to type -Template, powershell won't autocomplete the parameter. It doesn't even show up in the list of available parameters. If I try to use -Template first, I can then autocomplete the -Name parameter but then can't find the -Memory or -NumCpu parameter.
I am using PowerCLI 5.8 in my production environment and have also tried PowerCLI 6.3 Release 1. It happens all the same within Powershell. If I open the PowerCLI console window, everything autocompletes successfully. Am I missing something?
If using the -Template parameter, you will not have the options to set memory or numcpu as it uses the template. You can change those after the VM clones by using the Set-VM Cmdlet.
Hopefully I understood what you were saying, but the command as written would not work successfully.
Would be nice if that was listed somewhere. Thanks for the info.
The available options are always shown with available parameters in the syntax of the command reference...It's not the easiest thing to read, but here you go:
New-VM - vSphere PowerCLI Cmdlets Reference
Additionally, I recommend using an IDE which will greatly help with showing what is available, for instance, from Windows PowerShell ISE you can see these options broken out in the command reference: