I have the following code:
PS /home/user/Downloads> $templateName = "ulabs_t"
PS /home/user/Downloads> $template = Get-Template -Name $templateName
PS /home/user/Downloads> write-output $template Name
----
ulabs_t
PS /home/user/Downloads>
When I use New-VM without -Template, It creates a VM such as :
$vm = New-VM -VMHost $esx -Name debian -Datastore $ds -DiskStorageFormat Thin | Set-VM -NumCpu 2 -MemoryGB 4 -Confirm:$false
PS /home/user/Downloads>
But When I invoke -Template such as the following code, It can't create VM.:
S /home/user/Downloads> $vm = New-VM -VMHost $esx -Name debian -Datastore $ds -DiskStorageFormat Thin -Template $template| Set-VM -NumCpu 2 -MemoryGB 4 -Confirm:$false
New-VM: 4/13/2022 9:20:02 AM New-VM <<<<< mentioned to errr
PS /home/user/Downloads>
How can I create VM from Template with VM?
By the way, my template is exist on VC.
You will need to give the full error message
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
How to generate error messages in verbose mode?
The error message should be there independent of what you put in Verbose.
For adding verbose messages, add the -Verbose switch to the cmdlet.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
PS /home/user/Downloads> $vm = New-VM -VMHost $esx -Name vmm -Datastore $ds -DiskStorageFormat Thin -Template $template -Verbose
VERBOSE: Creates a new virtual machine with the specified parameters.
New-VM: 4/13/2022 2:48:06 PM New-VM
So there are no error messages (red lines)?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
RED LINE is :
New-VM: 4/13/2022 2:48:06 PM New-VM
I made a mistake, clicked in Correct answer.
Verbose messages are yellow, error messages are red.
But I noticed you marked your reply as the solution, so I assume the issue is fixed.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Unfortunately, I can't create VM from template via VM-New yet.Why did you change to solution? I get the red line.
I didn't change anything.
Are you by any chance using free ESXi licenses?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference