因此,我从命令行运行此操作以打开柱塞并连接。没有脚本,它可以正常工作。
putty.exe -ssh admin@xxx.xxx.xxx.xxx -pw ****** -m“ c:\ newvm.sh”
脚本是:
ACLI;
#创建Server2016的克隆
#vm.clone atest clone_from_vm =“ server2016refimage”内存= 8G num_cores_per_vcpu = 2 num_vcpus = 2;
#创建D驱动器
#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”;
如果我在油灰中运行它,每行都可以正常运行,但是我不确定是否正确地将命令串在一起。如果我尝试执行脚本,它将打开腻子会话,然后冻结。
我只是吠叫错误的树吗?我可以在某个地方为此提供一些基本知识吗?一些YouTube视频或PluralSight上的其他视频?Nutanix的文档只能让我走得太远,除此之外,在这里,我找不到Nutanix的其他资源。抱歉,新手的问题,但我很难过。
最好的答案Galad2003
\nacli vm.clone aTest clone_from_vm=\"Server2016RefImage\" memory=8G num_cores_per_vcpu=2 num_vcpus=2;\n
\nI 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.
\n
\nDo I need to add in a time delay between commands? Maybe this is something that would work better with a product like Ansible?
\n
\nIdeally I would like to just have the script prompt me for a VM name and IP when I run it.
\n
\nIf 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.
\n
\nI 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.","className":"post__content__best_answer"}">