Create vm from Template using Powershell | Nutanix Community
Skip to main content

I’m somewhat disappointed in the product, , trying to create a VM from a template using Powershell. Modules are installed and we’re of to a flying start with this:

 

Import-Module Nutanix.Cli

Import-Module Nutanix.Prism.PS.Cmds -Prefix NTNX

Import-Module Nutanix.Prism.Common -Prefix NTNX

Connect-PrismCentral -Server $PrismServer -Credential $cred -ForcedConnection -AcceptInvalidSSLCerts

 

After this we’re in strife. Even the simple example below (from https://portal.nutanix.com/page/documents/details?targetId=PS-Cmdlets-AOS-v6_8:cmd-ps-VM-auto-r.html) does not work:

New-VM -Name testvm1 -ClusterName poc-cluster -NumVcpus 1 -MemoryMb 500

 

Results in this:

Task(s) bf18c5bc-6588-4f49-8914-3ad5da414b27 failed due to Failed to call REST endpoint from Prism Central : cluster not reachable.

The cluster is reachable (on the same subnet), port 9440 is open and responding.

Any ideas?

Well, we actually had a misconfigured cluster..now it has been fixed so we get the Powershell modules to work and we can create empty virtual machines.

But, here is our current dilemma...we plan on deploying VM’s from a template, and would like to do this similar to what we did in VMware, specifying parameters such as compuer name and IP address (via VMWare’s custom specifications).

How would we go about to

  • Create a VM from a template, say “nutanix_vm_template”
  • Input parameters computer name and IP configuration

Any ideas?


Reply