So I run this from a command line to open putty and connect. It works fine without the script.
putty.exe -ssh firstname.lastname@example.org -pw ****** -m "C:\newVM.sh"
The script is:
#creates a clone of Server2016
#vm.clone aTest clone_from_vm="Server2016RefImage" memory=8G num_cores_per_vcpu=2 num_vcpus=2;
#creates a D drive
# vm.disk_create aTest bus=scsi create_size=200G index=1 container="Container-1";
#Add a NIC
#vm.nic_create aTest connected=true network="Vlan6";
Each line will run fine if I run it in putty but I am not sure if I am stringing the commands together correctly. If I try to execute the script it opens the putty session then freezes.
Am I just barking up the wrong tree? Is there somewhere I can go for some basic knowledge for this? Some youtube videos or something on Pluralsight? The nutanix documentation can only get me so far and other than that and here I can find no other resources for Nutanix. Sorry for the newbie question but I am stumped.
Best answer by galad2003
acli vm.clone aTest clone_from_vm="Server2016RefImage" memory=8G num_cores_per_vcpu=2 num_vcpus=2;
I can get them to run now using putty or plink, there seems to be no difference but what I can't do now is run multiple commands one after another. It will now clone my existing VM but I can't get it to add the hard drive or NIC from a script.
Do I need to add in a time delay between commands? Maybe this is something that would work better with a product like Ansible?
Ideally I would like to just have the script prompt me for a VM name and IP when I run it.
If there is a better way to do this please let me know. Again, I am used to running PS scripts from my laptop to a server and they execute the script. I am just trying to do the equivalent shell commands and I am just not that well versed in shell scripting.
I see Nutanix has PS commandlets but I have not gotten that to work in our environment yet and the ACLI are so elegant I hate to not use them.