Is there a way to execute a script (or PowerShell script/command) inside a newly created AHV VM which does not have an IP address yet? The VM has Nutanix Guest Tools installed.
I’m looking for automating the creation of a new VM.
In VMware, I use the Invoke-VMScript command. I didn’t know if Nutanix had something similar? Thanks!
Best answer by JeremyJ
You can include execution of a cloud-init script during VM creation or VM cloning. You said you are looking to automate VM creation so this should suit your purpose. Look for the guest-customization portion of the VM POST API body, here:
There is not currently a direct parallel to VMware’s Invoke-VMScript cmdlet. I don’t know the inner workings of that cmdlet but if it functions without network connectivity it must either use console access via API or the VM backdoor built into VMware Tools.
Nutanix Guest Tools relies on TCP/IP network connectivity as it does not utilize or create a backdoor access to VMs in the way that VMware Tools does. There currently is no API method to run commands on an AHV VM. Still like you said you’re looking at VM creation so cloud-init is the standard method of running a script to customize a Linux VM, like sysprep for windows (also supported) and should suit your purpose.