VMware Cloud Community
red888
Contributor
Contributor

New-VM cmdlet stalls when create a new VM (works fine in vCenter)

Not sure were the issue is here.

I can interactively create a VM in vCenter with exactly the same settings and it creates the VM like instantly.

I just tried to do this with New-VM and it is moving extremely slowly- initially I thought it had stalled.

Here is the command I'm running (creating this VM with the same settings in vCenter works fine).

$VMName = 'myVM'
$ResPool = Get-ResourcePool 'myResPool'
$Datastore = Get-Datastore 'mystore'
$Temp = Get-Template 'myTemp'
$Spec = Get-OSCustomizationSpec 'mySpec'
$Location = 'MyFolder'

New-VM -Name $VMName -Template $Temp -ResourcePool $ResPool -OSCustomizationSpec $Spec -Location $Location -Folder -Verbose

I vCenter this only takes a couple mins, but running this script is taking a long time. Its on 43% right now and in the console it says:

New-VM Started execution

Creates a VM with the specified parameters

New-VM Finished execution

0 Kudos
1 Reply
LucD
Leadership
Leadership

You could look at the events that both methods generate, from those you should be able to determine if there is a major time difference.

There are a few other locations where you could check for eventual issues, the vpxd log and the vmware.log.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference